I see now:
juju debug-hooks telegraf/2 # in another terminal, run juju run --unit telegraf/2 hoosk/update-status """ >>> from charmhelpers.core import hookenv >>> hookenv.metadata()['requires'].keys() dict_keys(['elasticsearch', 'juju-info', 'haproxy', 'memcached', 'apache', 'influxdb-api', 'postgresql', 'exec', 'mysql', 'mongodb']) >>> hookenv.relations_of_type('juju-info') [{'egress-subnets': '10.66.111.139/32', 'private-address': '10.66.111.139', 'ingress-address': '10.66.111.139', '__relid__': 'juju-info:4', '__unit__': 'ubuntu-lxd/0'}] >>> hookenv.relations_of_type('mysql') [{'egress-subnets': '10.66.111.200/32', 'private-address': '10.66.111.200', 'ingress-address': '10.66.111.200', '__relid__': 'mysql:3', 'database': 'telegraf', 'password': 'lai7Uo6uKahquai', 'slave': 'False', 'user': 'quoh3JiG8ahchuu', 'host': '10.66.111.200', '__unit__': 'mysql/0'}] """
I didn't expect hookenv.relations_of_type(...) to return units which the current telegraf unit is not subordinate of.
I'll work on a patch
I see now:
juju debug-hooks telegraf/2 # in another terminal, run juju run --unit telegraf/2 hoosk/update-status metadata( )['requires' ].keys( ) ['elasticsearch ', 'juju-info', 'haproxy', 'memcached', 'apache', 'influxdb-api', 'postgresql', 'exec', 'mysql', 'mongodb']) relations_ of_type( 'juju-info' ) relations_ of_type( 'mysql' )
"""
>>> from charmhelpers.core import hookenv
>>> hookenv.
dict_keys(
>>> hookenv.
[{'egress-subnets': '10.66.111.139/32', 'private-address': '10.66.111.139', 'ingress-address': '10.66.111.139', '__relid__': 'juju-info:4', '__unit__': 'ubuntu-lxd/0'}]
>>> hookenv.
[{'egress-subnets': '10.66.111.200/32', 'private-address': '10.66.111.200', 'ingress-address': '10.66.111.200', '__relid__': 'mysql:3', 'database': 'telegraf', 'password': 'lai7Uo6uKahquai', 'slave': 'False', 'user': 'quoh3JiG8ahchuu', 'host': '10.66.111.200', '__unit__': 'mysql/0'}]
"""
I didn't expect hookenv. relations_ of_type( ...) to return units which the current telegraf unit is not subordinate of.
I'll work on a patch