On 20 October 2014 19:00, Andreas Hasenack <[email protected]> wrote: > On Mon, Oct 20, 2014 at 9:55 AM, Christopher Glass <[email protected]> > wrote: >> >> Y's unit name should be accessible through "$JUJU_REMOTE_UNIT" from >> X's relation-joined hook. >> See >> http://juju-docs.readthedocs.org/en/latest/internals/unit-agent-hooks.html > > I tried that, but got in the weird situation where it's possible for a > relation to exist, but no units be part of it. > > In other words, if relids = relation_ids(name) and relids is not null, it's > possible for relation_list(relids[0]) to be empty.
If you are in foo-relation-joined or foo-relation-changed, then $JUJU_REMOTE_UNIT should certainly be set. I can imagine that relation_list might not list that unit yet, as the other end might not have had a chance to join the relation yet, but the JUJU_REMOTE_UNIT environment variable is part of the contract. -- Stuart Bishop <[email protected]> -- Juju mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju
