Skip to content

Instantly share code, notes, and snippets.

@jamesbeedy
Created October 25, 2017 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbeedy/b3ee89d9c266fb374db41e4642505a0e to your computer and use it in GitHub Desktop.
Save jamesbeedy/b3ee89d9c266fb374db41e4642505a0e to your computer and use it in GitHub Desktop.
http_interface_endpoints_network_get
from charmhelpers.core.hookenv import network_get
from charms.reactive import set_flag, clear_flag
from charms.reactive import Endpoint
class HttpProvides(Endpoint):
def configure(self, port, interface_name):
"""
Configure the HTTP relation by providing a port and interface_name.
"""
for relation in self.relations:
relation.send['host'] = network_get(interface_name)['ingress-addresses'][0]
relation.send['port'] = port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment