config values are re-set to their default values when only one is changed

Bug #873643 reported by Clint Byrum
6
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-notdefault'

# 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

Changed in juju:
importance: Undecided → High
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Problem is quite plain, but solution is not...

in juju/control/config_set.py, line 71

    config = yield charm.get_config()
    options = config.validate(options)

    # Apply the change
    state = yield service.get_config()
    state.update(options)
    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.

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
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Fixed in r409, precise has r424

Changed in juju (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Rolf Leggewie (r0lf) wrote :

oneiric has seen the end of its life and is no longer receiving any updates. Marking the oneiric task for this ticket as "Won't Fix".

Changed in juju (Ubuntu Oneiric):
status: Triaged → Won't Fix
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.