config values are re-set to their default values when only one is changed
Bug #873643 reported by
Clint Byrum
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pyjuju |
Fix Released
|
High
|
Clint Byrum | ||
juju (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Oneiric |
Won't Fix
|
High
|
Unassigned |
Bug Description
Test case:
deploy a service with two options:
options:
foo:
type: string
default: "foo-default"
description: "Foo"
bar:
type: string
default: "bar-default"
description: "Bar"
Then use debug-hooks on the unit just for config-changed, and note the values whenever values are changed:
$ juju set test-charm foo="not-default"
# config-get
{u'foo': u'foo-notdefault', u'bar': u'bar-default'}
Then
$ juju set test-charm bar='bar-
# config-get
What I would expect would be
{u'foo': u'foo-notdefault', u'bar': u'bar-notdefault'}
What I see instead is
{u'foo': u'foo-default', u'bar': u'bar-notdefault'}
Related branches
lp:~clint-fewbar/pyjuju/config-do-not-overwrite
- Juju Engineering: Pending requested
-
Diff: 12 lines (+1/-1)1 file modifiedjuju/control/config_set.py (+1/-1)
lp:~bcsaller/pyjuju/config-do-not-overwrite
- Jim Baker (community): Approve
-
Diff: 119 lines (+63/-2)5 files modifiedjuju/charm/tests/repository/series/configtest/config.yaml (+9/-0)
juju/charm/tests/repository/series/configtest/metadata.yaml (+8/-0)
juju/charm/tests/repository/series/configtest/revision (+1/-0)
juju/control/config_set.py (+2/-1)
juju/control/tests/test_config_set.py (+43/-1)
Changed in juju: | |
importance: | Undecided → High |
Changed in juju: | |
milestone: | none → florence |
status: | New → Fix Committed |
assignee: | nobody → Clint Byrum (clint-fewbar) |
Changed in juju: | |
status: | Fix Committed → In Progress |
Changed in juju: | |
status: | In Progress → Fix Released |
Changed in juju (Ubuntu Oneiric): | |
status: | New → Triaged |
Changed in juju (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in juju (Ubuntu Oneiric): | |
importance: | Undecided → High |
To post a comment you must log in.
Problem is quite plain, but solution is not...
in juju/control/ config_ set.py, line 71
config = yield charm.get_config() validate( options)
options = config.
# Apply the change get_config( ) update( options)
state = yield service.
state.
yield state.write()
validate() returns with defaults filled, in and then only overwrites those that were explicitly set in the options argument.
Since validate() will raise an error if any of the options are bad, the correct thing to do would seem to be to change it to not overwrite the 'options' variable, which corrects the cited problem.