JUJU_UNIT_NAME no longer set in env

John Meinel john at arbash-meinel.com
Tue May 23 07:56:30 UTC 2017


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 units on one machine).

If you need to run the install hook, I *think* you could get into a charm
context with "juju-run ???/install". I don't know whether you'd need to
give the full path, just the last bit of the hook path, or what exactly. I
*think* the hook context actually runs in the directory just above 'hooks',
but I'm not 100% positive.

John
=:->


On Tue, May 23, 2017 at 9:49 AM, Ian Booth <ian.booth at canonical.com> wrote:

> 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() from hookenv.
> >
> > http://paste.ubuntu.com/24626263/
> >
> > Did we remove this?
> >
> > ~James
> >
> >
> >
>
> --
> Juju mailing list
> Juju at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/juju
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20170523/c0ef7877/attachment.html>


More information about the Juju mailing list