1

I tried installing Discourse form a juju charm, but the install hook failed because of some GPG problem. I tried to debug it using:

juju debug-hooks discourse/0 install

But the folder where this shell that was started (~) doesn't have the hooks subfolder, as the documentation states. What is more, when I manually navigate to /var/lib/juju/agents/unit-discourse-0/charm/ and run the hook from there, using

./hooks/install

I get errors about environment variables being not set (like $CHARM_DIR) and commands not available (like config-get). The point is, the script does not even get to the GPG stuff that failed before, it fails on one of the first lines.

What could have caused this? Is it my misunderstanding of the docs, or a bug in juju?

1 Answer 1

1

The problem is possibly that your debug session is not in time to catch the install hook failing (https://jujucharms.com/docs/stable/developer-debugging#debugging-early-hooks). In this case, the debugging terminal which is opened is merely waiting for a watched hook to activate (you get a new window for a hook event and the prompt will reflect the name of the hook). This is covered in the documentation. The subsequent errors when you try to run the hook manually are because hooks need to be run from within the hook environment to access the runtime environment variables.

You can either modify the install hook (as mentioned in the link above) or it may be possible to infer what has happened simply by looking at the logs:

https://jujucharms.com/docs/stable/developer-debugging#the-%27debug-log%27-command

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .