keystone charm makes wrong assumptions about charm directory, fails to deploy with juju-core
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
keystone (Juju Charms Collection) |
Fix Released
|
Undecided
|
Andreas Hasenack |
Bug Description
When deployed with juju-core, this error happens:
2013/04/25 13:53:14 INFO worker/uniter: HOOK Traceback (most recent call last):
2013/04/25 13:53:14 INFO worker/uniter: HOOK File "/var/lib/
2013/04/25 13:53:14 INFO worker/uniter: HOOK utils.do_
2013/04/25 13:53:14 INFO worker/uniter: HOOK File "/var/lib/
2013/04/25 13:53:14 INFO worker/uniter: HOOK hook_func()
2013/04/25 13:53:14 INFO worker/uniter: HOOK File "/var/lib/
2013/04/25 13:53:14 INFO worker/uniter: HOOK save_script_
2013/04/25 13:53:14 INFO worker/uniter: HOOK File "/var/lib/
2013/04/25 13:53:14 INFO worker/uniter: HOOK with open(juju_rc_path, 'wb') as rc_script:
2013/04/25 13:53:14 INFO worker/uniter: HOOK IOError: [Errno 2] No such file or directory: '/var/lib/
Note the charm directory layout changed between pyjuju and gojuju. In gojuju (juju-core) we have:
root@ip-
.
├── agents
│ ├── machine-1
│ └── unit-keystone-0
│ ├── charm
│ │ ├── hooks
│ │ │ └── lib
│ │ ├── scripts
│ │ └── templates
│ └── state
│ ├── bundles
│ │ └── downloads
│ ├── deployer
│ │ ├── current -> /var/lib/
│ │ └── update-
│ │ ├── hooks
│ │ │ └── lib
│ │ ├── scripts
│ │ └── templates
│ └── relations
└── tools
├── 1.10.0-
├── machine-1 -> 1.10.0-
└── unit-keystone-0 -> 1.10.0-
(I hope the above renders correctly. If not: http://
It was suggested to use $CHARM_DIR instead, if the charm really needs to write that file somewhere inside the charm directory. It's exported by both pyjuju and gojuju.
Related branches
- OpenStack Charmers: Pending requested
-
Diff: 21 lines (+3/-3)2 files modifiedhooks/lib/openstack_common.py (+2/-2)
revision (+1/-1)
Changed in keystone (Juju Charms Collection): | |
status: | In Progress → Fix Released |
tags: | added: landscape |
This fixed it for gojuju, but is untested for pyjuju:
=== modified file 'hooks/ lib/openstack_ common. py' openstack_ common. py 2013-03-21 18:25:39 +0000 openstack_ common. py 2013-04-25 14:14:55 +0000 'JUJU_UNIT_ NAME'). replace( '/', '-') juju/units/ %s/charm/ %s" % (unit_name, script_path) 'CHARM_ DIR')
rc_script. write(
" #!/bin/ bash\n" )
--- hooks/lib/
+++ hooks/lib/
@@ -221,8 +221,8 @@
updated config information necessary to perform health checks or
service changes.
"""
- unit_name = os.getenv(
- juju_rc_path = "/var/lib/
+ charm_dir = os.getenv(
+ juju_rc_path = "%s/%s" % (charm_dir, script_path)
with open(juju_rc_path, 'wb') as rc_script: