juju get does not print default values correctly

Bug #1130149 reported by Roger Peppe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
High
Roger Peppe

Bug Description

juju get should print current config values even if they are currently
set to their default values. Currently it always prints null for default values.

Revision history for this message
Roger Peppe (rogpeppe) wrote :

I thought this was fixed, but no...

the fix is in statecmd.merge:

// Merge service settings and charm schema.
func merge(serviceCfg map[string]interface{}, charmCfg map[string]charm.Option) map[string]interface{} {
 results := make(map[string]interface{})
 log.Infof("charm config %#v", charmCfg)
 log.Infof("service config %#v", serviceCfg)
 for k, v := range charmCfg {
  m := map[string]interface{}{
   "description": v.Description,
   "type": v.Type,
  }
  s, ok := serviceCfg[k]
  if ok && s != nil {
   m["value"] = s
   if v.Default != nil && reflect.DeepEqual(v.Default, s) {
    m["default"] = true
   }
  } else {
   // Breaks compatibility with py/juju (is this true any more?)
   m["value"] = v.Default
  }
  results[k] = m
 }
 return results
}

Revision history for this message
Roger Peppe (rogpeppe) wrote :
Changed in juju-core:
status: New → Fix Committed
assignee: nobody → Roger Peppe (rogpeppe)
importance: Undecided → High
Tim Penhey (thumper)
Changed in juju-core:
status: Fix Committed → 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.