python template produces invalid config-changed hook code
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
New
|
Undecided
|
Unassigned |
Bug Description
Creating a python charm with the charm-helper produces a broken 'config-changed' script that fails to import 'start' with the following error:
unit-foobar-0: 2014-08-18 22:23:08 INFO juju-log Installing foobar
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed Traceback (most recent call last):
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed File "/var/lib/
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed from start import start
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed ImportError: No module named start
Steps to recreate:
# juju charm create foobar
INFO: Using default charm template (python). To select a different template, use the -t option.
INFO: Generating charm for foobar in ./foobar
INFO: No foobar in apt cache; creating an empty charm instead.
Symlink all hooks to one python source file? [yN] n
INFO:root:Loading charm helper config from charm-helpers.yaml.
INFO:root:Checking out lp:charm-helpers to /tmp/tmptkKE_
Branched 194 revisions.
INFO:root:Syncing directory: /tmp/tmptkKE_
INFO:root:Adding missing __init__.py: lib/charmhelper
# mkdir trusty
# ln -s ../foobar trusty/.
# juju deploy --repository . local:trusty/foobar
# juju debug-log
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.cmd supercommand.go:37 running jujud [1.20.5-
unit-foobar-0: 2014-08-18 22:23:02 DEBUG juju.agent agent.go:377 read agent config, format "1.18"
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.jujud unit.go:76 unit agent unit-foobar-0 start (1.20.5-
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.worker runner.go:260 start "api"
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.state.api apiclient.go:242 dialing "wss://
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.state.api apiclient.go:176 connection established to "wss://
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.state.api apiclient.go:242 dialing "wss://
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.state.api apiclient.go:176 connection established to "wss://
unit-foobar-0: 2014-08-18 22:23:03 INFO juju.state.api apiclient.go:242 dialing "wss://
unit-foobar-0: 2014-08-18 22:23:03 INFO juju.state.api apiclient.go:176 connection established to "wss://
unit-foobar-0: 2014-08-18 22:23:04 INFO juju.worker runner.go:260 start "upgrader"
unit-foobar-0: 2014-08-18 22:23:04 INFO juju.worker runner.go:260 start "logger"
unit-foobar-0: 2014-08-18 22:23:04 DEBUG juju.worker.logger logger.go:35 initial log config: "<root>=DEBUG"
unit-foobar-0: 2014-08-18 22:23:04 INFO juju.worker runner.go:260 start "uniter"
unit-foobar-0: 2014-08-18 22:23:04 DEBUG juju.worker.logger logger.go:60 logger setup
unit-foobar-0: 2014-08-18 22:23:04 INFO juju.worker runner.go:260 start "apiaddressupdater"
unit-foobar-0: 2014-08-18 22:23:04 INFO juju.worker runner.go:260 start "rsyslog"
unit-foobar-0: 2014-08-18 22:23:04 DEBUG juju.worker.rsyslog worker.go:75 starting rsyslog worker mode 1 for "unit-foobar-0" ""
unit-foobar-0: 2014-08-18 22:23:04 DEBUG juju.worker.logger logger.go:45 reconfiguring logging from "<root>=DEBUG" to "<root>
unit-foobar-0: 2014-08-18 22:23:08 INFO juju-log Installing foobar
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed Traceback (most recent call last):
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed File "/var/lib/
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed from start import start
unit-foobar-0: 2014-08-18 22:23:12 INFO config-changed ImportError: No module named start
unit-foobar-0: 2014-08-18 22:23:12 ERROR juju.worker.uniter uniter.go:486 hook failed: exit status 1
unit-ubuntu-
The problem here is that the file is 'setup' and not 'setup.py', so it can't be imported. Not sure what you would like to do for the template skeleton.