Beware global state in hooks

Kapil Thangavelu kapil.thangavelu at
Mon Sep 16 23:12:35 UTC 2013

Process hierarchy

unit agent -> hook -> juju-cli hook api (config-get/relation-get/set)

He's saying the hook env can effect runtime of the hook cli api. Its
debatable, but one option might be white-listing env variables that the
hooks support, and unsetting those not related.

On Tue, Sep 17, 2013 at 7:52 AM, David Cheney <david.cheney at>wrote:

> > Be careful when touching process-global state when writing charm
> > hooks. Calling out to the juju tools such as config-get will inherit
> > the normal C environment, and juju may break in surprising ways if you
> > don't leave it how you found it.
> I'm confused, are you saying the subprocess was able to mutate the
> environment of the caller ? I really don't follow.
> --
> Juju mailing list
> Juju at
> Modify settings or unsubscribe at:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Juju mailing list