API change: relation-broken hook context
William Reade
william.reade at canonical.com
Thu Dec 8 22:31:33 UTC 2011
It has become apparent that RelationHookContext is somewhat broken in
the context of relation-broken: that is to say that commands like
get-members are not guaranteed to work correctly, because state they
depend upon may already have been deleted (by, say, the client
requesting service destruction).
I propose that relation-broken should execute in a plain old HookContext
(just like install/start/etc, but with JUJU_RELATION_NAME -- which is
useful -- set in the environment).
Beneficial consequences:
* No opportunity for annoying bugs when state is missing
* The code becomes a little better fitted to the problem, IMO
Unpleasant consequences:
* Some charms may need to change
Unintended consequences:
* ?
I admit that I haven't audited existing charms for use of unsafe
commands, but I don't see that we have a practical way around the
missing-state problem [0]. Given that, using RHC over HC for
relation-broken just offers us a few extra commands of dubious utility
and possible brokenness: and so if we can't guarantee they'll work, I
feel we should just leave them out.
Thoughts?
Cheers
William
[0] We could maybe do better if we had GC, but I'm not sure *any* of the
commands exposed by RelationHookContext are really very meaningful when
we're running relation-broken anyway.
More information about the Juju
mailing list