Hell again Merlijn,

It was nice to see you at the Charmer summit!  This is a very interesting
use of Juju.

What you are seeing is what we call a "hook context".  Hooks execute with
root authority and have certain environment variables are set. This is so
Juju commands and tools work correctly.  The debug-hooks command puts you
into a "hook context" when you run  'juju resolved --retry unit/#'

As I wrote all hooks are executed with these environment variables set.  If
you are running the install script manually outside of a hook context these
environment variables would not be set.

There is more information about the environment variables here:

https://jujucharms.com/docs/devel/authors-hook-environment

However, I don't see "JUJU_HOME" listed on this page. Perhaps you could
give me more information on what variable is causing a problem and perhaps
your hooks could set those values in the case where the script runs
manually.

Cheers!

   - Matt Bruzek <matthew.bru...@canonical.com>

On Tue, Oct 6, 2015 at 5:07 AM, Merlijn Sebrechts <
merlijn.sebrec...@gmail.com> wrote:

> Hi
>
>
> I'm developing a Charm that installs the Juju client, among other things.
> I'm having some trouble getting this to work. When I use juju debug-hooks
> and manually run the install hook, everything works fine. However, when the
> hook is executed by Juju automatically, I get strange errors such as
> "error: cannot determine juju home, required environment variables are not
> set"
>
> Both the debug-hooks and the normal hook environment execute as root.
> However, a lot of env vars are different, like the home dir.
>
> Debug-hooks:
>     echo ~ : /home/ubuntu
> hook env:
>     echo ~: /root
>
> Is this intentional? This causes a lot of bugs that cannot be reproduced
> by debug-hooks. Is there a way to solve  "error: cannot determine juju
> home, required environment variables are not set"?
>
>
>
> Kind regards
> Merlijn Sebrechts
>
> --
> Juju mailing list
> Juju@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju

Reply via email to