Config options remain in hookenv.config() even when unset

Bug #1630706 reported by Casey Marshall
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
Undecided
Unassigned

Bug Description

Steps to reproduce:

With a charm that has a config option without a default value,

- Set the value to something: `juju config mycharm foo=100`
- Observe the config-changed hook fires, and the option is set in hookenv.config()
- Now, unset the value: `juju config --reset mycharm foo`
- When config-changed fires, hookenv.config() still shows {foo: 100}
- However, `juju config mycharm` will show the value is unset. And, I've also confirmed this in the Juju DB.

The problem seems to be that keys are never removed from `/var/lib/juju/agents/unit-mycharm-0/charm/.juju-persistent-config` even when unset.

Revision history for this message
Casey Marshall (cmars) wrote :

This was with charmhelpers-0.9.1.tar.gz btw

Revision history for this message
Cory Johns (johnsca) wrote :

Per https://code.launchpad.net/~simonklb/charm-helpers/include-empty-config-options/+merge/309105 I think the correct behavior would be to have hookenv.config() always return all config options and their values, even if those values are default.

Any objection to supporting that behavior instead?

Cory Johns (johnsca)
Changed in charm-helpers:
status: New → 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.