github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/state/testing/config.go (about)

     1  // Copyright 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package testing
     5  
     6  import (
     7  	"launchpad.net/juju-core/state"
     8  )
     9  
    10  // UpdateConfig sets the current agent version in the state's
    11  // environment configuration.
    12  func UpdateConfig(st *state.State, newValues map[string]interface{}) error {
    13  	cfg, err := st.EnvironConfig()
    14  	if err != nil {
    15  		return err
    16  	}
    17  	newcfg, err := cfg.Apply(newValues)
    18  	if err != nil {
    19  		return err
    20  	}
    21  	return st.SetEnvironConfig(newcfg, cfg)
    22  }