python template produces invalid config-changed hook code

Bug #1358518 reported by Robert C Jennings
8
This bug affects 1 person
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/juju/agents/unit-foobar-0/charm/hooks/config-changed", line 13, in <module>
 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_7/charm-helpers.
Branched 194 revisions.
INFO:root:Syncing directory: /tmp/tmptkKE_7/charm-helpers/charmhelpers/core -> lib/charmhelpers/core.
INFO:root:Adding missing __init__.py: lib/charmhelpers/__init__.py

# 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-trusty-amd64 gc]
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-trusty-amd64 [gc])
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://10.55.32.153:17070/"
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.state.api apiclient.go:176 connection established to "wss://10.55.32.153:17070/"
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.state.api apiclient.go:242 dialing "wss://10.55.32.153:17070/"
unit-foobar-0: 2014-08-18 22:23:02 INFO juju.state.api apiclient.go:176 connection established to "wss://10.55.32.153:17070/"
unit-foobar-0: 2014-08-18 22:23:03 INFO juju.state.api apiclient.go:242 dialing "wss://10.55.32.153:17070/"
unit-foobar-0: 2014-08-18 22:23:03 INFO juju.state.api apiclient.go:176 connection established to "wss://10.55.32.153:17070/"
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>=WARNING;unit=DEBUG"
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/juju/agents/unit-foobar-0/charm/hooks/config-changed", line 13, in <module>
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-software-repo-mirror-0: 2014-08-18 22:23:05 WARNING juju.worker.uniter.charm git_deployer.go:200 no current staging repo

Revision history for this message
Robert C Jennings (rcj) wrote :
Revision history for this message
Robert C Jennings (rcj) wrote :

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.

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.