debug-code fails if hook doesn't exist

Bug #1876290 reported by John A Meinel
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
John A Meinel

Bug Description

If you run 'juju debug-hooks' then Juju will always trigger an event for every hook, whether or not it exists.
It was designed to do this so that someone debugging a charm could see that there is a lifecycle event, even if the hook isn't implemented, in case they want to actually start to implement it.
Which is fine, if a human tries to run './hooks/no-such-hook' then they get told it doesn't exist, and they can choose whether they want to exit 0 or exit 1 from the shell.

However, debug-code acts differently, in that it goes ahead and runs ./hooks/install (etc) so that the code being executed has a chance to actually run and grab an internal debugger.

However, if the charm doesn't implement a hook, then it gets a bad error that just keeps happening in the log:

unit-dummy-sink-0: 15:41:57 ERROR juju.worker.uniter.operation hook "source-relation-created" (via unknown/invalid hook handler) failed: exit status 1

An easy way to test it is

cd acceptancetests/repository/charms
juju deploy ./dummy-sink
juju deploy ./dummy-source

juju debug-code dummy-source/0

in another terminal
juju relate dummy-sink dummy-source

and you see 'source-relation-changed' errors like above (because source-relation-changed isn't implemented.

Actually, debug-hooks itself acts a bit silly, as it ends up printing:
3. To run an action or hook and end the debugging session avoiding processing any more events manually, use:

./

We should probably change the splash message a bit more if the hook is not implemented.

Revision history for this message
Tim Penhey (thumper) wrote :
Changed in juju:
status: Triaged → Fix Committed
Harry Pidcock (hpidcock)
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.