Bugs for the "charm" tool

Where is the bug:s url for the “charm” tool?

I was hit by a bug that “charm build” creates empty hook scripts that fails to execute. The scripts are are added automatically to my built charm, so I feel this must be a problem with “charm” and/or juju failing to execute these scripts.

#ubuntu@juju-04b40a-0:~$ cat /var/log/juju/unit-realmd-ubuntu-0.log  | grep ERROR
2020-06-11 12:17:34 ERROR juju.worker.uniter.operation runhook.go:132 hook "leader-elected" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/leader-elected: exec format error
2020-06-11 12:17:40 ERROR juju.worker.uniter.operation runhook.go:132 hook "leader-elected" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/leader-elected: exec format error
2020-06-11 12:17:51 ERROR juju.worker.uniter.operation runhook.go:132 hook "leader-elected" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/leader-elected: exec format error
2020-06-11 12:18:12 ERROR juju.worker.uniter.operation runhook.go:132 hook "leader-elected" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/leader-elected: exec format error
2020-06-11 12:18:53 ERROR juju.worker.uniter.operation runhook.go:132 hook "leader-elected" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/leader-elected: exec format error
2020-06-11 12:20:17 ERROR juju.worker.uniter.operation runhook.go:132 hook "leader-elected" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/leader-elected: exec format error
2020-06-11 12:21:23 ERROR juju.worker.uniter.operation runhook.go:132 hook "juju-info-relation-joined" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/juju-info-relation-joined: exec format error
2020-06-11 12:21:28 ERROR juju.worker.uniter.operation runhook.go:132 hook "juju-info-relation-joined" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/juju-info-relation-joined: exec format error
2020-06-11 12:21:38 ERROR juju.worker.uniter.operation runhook.go:132 hook "juju-info-relation-joined" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/juju-info-relation-joined: exec format error
2020-06-11 12:21:58 ERROR juju.worker.uniter.operation runhook.go:132 hook "juju-info-relation-changed" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/juju-info-relation-changed: exec format error
2020-06-11 12:22:01 ERROR juju.worker.uniter.operation runhook.go:132 hook "juju-info-relation-changed" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/juju-info-relation-changed: exec format error
2020-06-11 12:22:06 ERROR juju.worker.uniter.operation runhook.go:132 hook "juju-info-relation-changed" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/juju-info-relation-changed: exec format error
2020-06-11 12:25:06 ERROR juju.worker.uniter.operation runhook.go:132 hook "update-status" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/update-status: exec format error
2020-06-11 12:25:26 ERROR juju.worker.uniter.operation runhook.go:132 hook "update-status" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/update-status: exec format error
2020-06-11 12:26:06 ERROR juju.worker.uniter.operation runhook.go:132 hook "update-status" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/update-status: exec format error
2020-06-11 12:27:28 ERROR juju.worker.uniter.operation runhook.go:132 hook "update-status" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/update-status: exec format error
2020-06-11 12:30:15 ERROR juju.worker.uniter.operation runhook.go:132 hook "update-status" failed: fork/exec /var/lib/juju/agents/unit-realmd-ubuntu-0/charm/hooks/update-status: exec format error

After removing the empty scripts, it all works fine.

juju 2.8
charmstore-client 2.4.0+snap-461+git-13-547c6f2
charm-tools 2.7.4

Bugs are filed on GitHub, either https://github.com/juju/charm-tools (for the build portions) or https://github.com/juju/charmstore-client (for the store interactions).

The hooks are generated from the hooks/hook.template file, such as the one provided by layer:basic, or, for Kubernetes charms, the one provided by layer:caas-base. Is your charm or one of the layers that you’re including overriding that file somehow? If the file was missing entirely, you should received a build error, so it sounds like it’s being replaced by an empty file at some point.

1 Like

The hooks.template file has been a mystery for me for some time.

My charm is a “hooks only bash” charm which I need to avoid dependencies to python and charm libraries alltogether (centos6,7 will not like that).

Since I use the “charm build” command anyway (to benefit from validating that it is sane) - I include an empty hooks.template. This has worked until juju 2.8 I think but now starts to produce errors.

What would a “hooks.template” file look like which is not a python script? @cory_fu