github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/state/testing/agent.go (about)

     1  // Copyright 2012, 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package testing
     5  
     6  import (
     7  	"github.com/juju/version"
     8  
     9  	"github.com/juju/juju/state"
    10  )
    11  
    12  // SetAgentVersion sets the current agent version in the state's
    13  // model configuration.
    14  // This is similar to state.SetModelAgentVersion but it doesn't require that
    15  // the model have all agents at the same version already.
    16  func SetAgentVersion(st *state.State, vers version.Number) error {
    17  	model, err := st.Model()
    18  	if err != nil {
    19  		return err
    20  	}
    21  	return model.UpdateModelConfig(map[string]interface{}{"agent-version": vers.String()}, nil)
    22  }