Break a relationship from the config-change hook

Tim Van Steenburgh tim.van.steenburgh at canonical.com
Fri Oct 17 18:35:44 UTC 2014


>
> In my config-change hook when triggered after initial install, changes
> will have effect on some of the relationships already established. The
> relationship has to be broken/invalidated and reestablished.
>
> 1) How can I check what relations are established from within the
> config-changed hook ?
>

You can use `relation-ids` and `relation-list` for this. [1]


> 2) How can I executed the “*relation-broken” hook from the "config-change"
> hook for those relationship which are established ?
>

Instead of breaking and reestablishing existing relationships, you'll want
to reconfigure them. Use `relation-set` [2] to set relation data from
within you config-changed hook. This will trigger the *relation-changed
hook on related units. Those units can get the new relation data using
`relation-get`, reconfigure themselves, and if necessary, restart their
service(s).

[1] https://juju.ubuntu.com/docs/authors-hook-environment.html#relation-list
[2] https://juju.ubuntu.com/docs/authors-hook-environment.html#relation-set
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20141017/18097e9d/attachment.html>


More information about the Juju mailing list