Re: JUJU_UNIT_NAME no longer set in env

2017-05-23 Thread Nick Veitch
On 23 May 2017 at 14:12, Jay Wren wrote: > I was under the impression that `juju run --unit` does run in a hook > context. In fact, the help for `juju help run` explicitly says: > ah yes, sorry, I missed the --unit bit. -- Nick Veitch, Documentation Canonical --

Re: JUJU_UNIT_NAME no longer set in env

2017-05-23 Thread John Meinel
juju run --application runs as every unit of the application, thus we have individual units (if you have 2 units of an application on a machine it will run twice on that machine). 'juju run --unit" obviously runs as a unit. 'juju machine' can't, because we don't have any unit associated with it.

Re: JUJU_UNIT_NAME no longer set in env

2017-05-23 Thread Jay Wren
I was under the impression that `juju run --unit` does run in a hook context. In fact, the help for `juju help run` explicitly says: ``` Commands run for applications or units are executed in a 'hook context' for the unit. ``` A quick test: ``` > juju run --unit u4/0 'echo $JUJU_UNIT_NAME'

Re: JUJU_UNIT_NAME no longer set in env

2017-05-23 Thread Nick Veitch
On 23 May 2017 at 11:23, Junien Fridrick wrote: > > You can run some hooks like config-changed with e.g. : > > $ juju run --unit foo/0 hooks/config-changed > You can run any hook like that, but if it requires a hook context (as in the example of trying to read

Re: JUJU_UNIT_NAME no longer set in env

2017-05-23 Thread Junien Fridrick
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

Re: JUJU_UNIT_NAME no longer set in env

2017-05-23 Thread Nick Veitch
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.

Re: JUJU_UNIT_NAME no longer set in env

2017-05-23 Thread John Meinel
So you're running the 'install' hook directly, are you currently in a 'juju debug-hooks' session, or are you just changing into that directory? Juju sets it during the run of a charm hook, but it is not set globally on the machine (we can't set UNIT globally anyway, because you can colocate many

Re: JUJU_UNIT_NAME no longer set in env

2017-05-22 Thread Ian Booth
FWIW, Juju itself still sets JUJU_UNIT_NAME https://github.com/juju/juju/blob/develop/worker/uniter/runner/context/context.go#L582 On 23/05/17 05:59, James Beedy wrote: > Juju 2.1.2 > > I'm getting this "JUJU_UNIT_NAME not in env" error on legacy-non-reactive > xenial charm using service_name()

JUJU_UNIT_NAME no longer set in env

2017-05-22 Thread James Beedy
Juju 2.1.2 I'm getting this "JUJU_UNIT_NAME not in env" error on legacy-non-reactive xenial charm using service_name() from hookenv. http://paste.ubuntu.com/24626263/ Did we remove this? ~James -- Juju mailing list Juju@lists.ubuntu.com Modify settings or unsubscribe at:

JUJU_UNIT_NAME no longer set in env

2017-05-22 Thread James Beedy
Juju 2.1.2 I'm getting this "JUJU_UNIT_NAME not in env" error on legacy-non-reactive xenial charm using service_name() from hookenv. http://paste.ubuntu.com/24626263/ Did we remove this? ~James -- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: