Skip to content

Instantly share code, notes, and snippets.

@marcoceppi
Created January 3, 2017 21:07
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 marcoceppi/193a8e4c37463cae95807499160ea7df to your computer and use it in GitHub Desktop.
Save marcoceppi/193a8e4c37463cae95807499160ea7df to your computer and use it in GitHub Desktop.
from charmhelpers.core.hookenv import relation_ids, related_units, relation_get
for rid in relation_ids('database'):
for u in related_units(rid):
print('Hostname: %s' % relation_get('hostname', unit=u, rid=rid))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment