JUJU_UNIT_NAME no longer set in env

Junien Fridrick junien.fridrick at canonical.com
Tue May 23 10:23:42 UTC 2017


On Tue, May 23, 2017 at 10:08:45AM +0100, Nick Veitch wrote:
> I don't believe you can (usually) execute hooks properly e.g. via 'juju
> run' or ssh, precisely because the hook doesn't then run in a hook context.
> If you run 'juju debug-hooks' and wait for a hook to fire, then the various
> $ENV variables should be available in that session.
> 
> https://jujucharms.com/docs/stable/developer-debugging#the-'debug-hooks'-command

You can run some hooks like config-changed with e.g. :

$ juju run --unit foo/0 hooks/config-changed

I _think_ you can't run relation hooks because you need extra context. I
also _think_ you should be able to run an install hook with "juju run",
as above.

Running hooks this way won't trigger debug-hooks.

Cheers



More information about the Juju mailing list