after upgrade-charm, new config settings do not all have default values

Bug #900560 reported by Clint Byrum
12
This bug affects 2 people
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-1juju2~oneiric1
  Candidate: 0.5+bzr427-1juju2~oneiric1
  Version table:
 *** 0.5+bzr427-1juju2~oneiric1 0
        500 http://ppa.launchpad.net/juju/pkgs/ubuntu/ oneiric/main i386 Packages
        100 /var/lib/dpkg/status
     0.5+bzr398-0ubuntu1 0
        500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric/universe i386 Packages

Related branches

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
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Defaults should probably be lazily computed, rather than hard-coded onto the actual settings node.

Changed in juju:
status: In Progress → Fix Released
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.