after upgrade-charm, new config settings do not all have default values
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pyjuju |
Fix Released
|
Medium
|
Kapil Thangavelu |
Bug Description
Seems on upgrading a charm the defaults from config.yaml are not populated into the configs of a service. This can cause major problems for config-changed hooks that assume those values will be set to something that makes sense, especially in the case of 'int' config values which should always, by definition, have an integer value.
Test case:
deploy an empty charm
add a config.yaml with one setting
options:
foo:
type: int
default: 1
description: fooberries
bar:
type: string
default: "baz"
description: "bar-tastic"
upgrade-charm to pick this config change up, the start debug-hooks and run
juju set myservice bar="something"
In debug-hooks
# config-get --format=json
{"bar": "something"}
#
No defaults!
juju:
Installed: 0.5+bzr427-
Candidate: 0.5+bzr427-
Version table:
*** 0.5+bzr427-
500 http://
100 /var/lib/
0.
500 http://
Related branches
- William Reade (community): Approve
- Benjamin Saller (community): Approve
-
Diff: 393 lines (+148/-41)11 files modifiedjuju/charm/config.py (+4/-6)
juju/charm/tests/test_config.py (+2/-6)
juju/control/config_get.py (+8/-7)
juju/control/deploy.py (+0/-1)
juju/control/tests/test_config_get.py (+2/-2)
juju/control/tests/test_upgrade_charm.py (+70/-2)
juju/control/upgrade_charm.py (+2/-0)
juju/state/service.py (+28/-2)
juju/state/tests/test_hook.py (+8/-3)
juju/state/tests/test_service.py (+23/-11)
juju/state/utils.py (+1/-1)
Changed in juju: | |
importance: | Undecided → Medium |
tags: | added: upgrade-charm |
Changed in juju: | |
milestone: | none → florence |
assignee: | nobody → Kapil Thangavelu (hazmat) |
status: | New → In Progress |
Changed in juju: | |
status: | In Progress → Fix Released |
Defaults should probably be lazily computed, rather than hard-coded onto the actual settings node.