Skip to content

Instantly share code, notes, and snippets.

@jamesbeedy
Created November 29, 2017 19:09
Show Gist options
  • Save jamesbeedy/d920318e081fc083de980869b085e303 to your computer and use it in GitHub Desktop.
Save jamesbeedy/d920318e081fc083de980869b085e303 to your computer and use it in GitHub Desktop.
class HttpProvides(Endpoint):
@when('endpoint.{endpoint_name}.joined')
def joined(self):
set_flag(self.expand_name('{endpoint_name}.available'))
@when_not('endpoint.{endpoint_name}.joined')
def broken(self):
clear_flag(self.expand_name('{endpoint_name}.available'))
def configure(self, host, port, services=None):
ctxt = {'host': host, 'port': port}
if services:
ctxt['services'] = services
for relation in self.relations:
relation.to_publish_raw.update(ctxt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment