~rogpeppe/juju-core/axwalk-lp1300889-disable-mongo-keyfile

« back to all changes in this revision

Viewing changes to upgrades/upgrade.go

  • Committer: Jesse Meek
  • Date: 2014-03-07 23:03:04 UTC
  • mfrom: (2394 juju-core)
  • mto: This revision was merged to the branch mainline in revision 2433.
  • Revision ID: jesse.meek@canonical.com-20140307230304-k6rkxj7jps31am0q
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import (
7
7
        "fmt"
8
8
 
9
 
        "github.com/loggo/loggo"
 
9
        "github.com/juju/loggo"
10
10
 
11
11
        "launchpad.net/juju-core/agent"
 
12
        "launchpad.net/juju-core/state"
12
13
        "launchpad.net/juju-core/state/api"
13
14
        "launchpad.net/juju-core/version"
14
15
)
78
79
        // APIState returns an API connection to state.
79
80
        APIState() *api.State
80
81
 
81
 
        // AgentConfig returns the agent config for the machine that is being upgraded.
 
82
        // State returns a connection to state. This will be non-nil
 
83
        // only in the context of a state server.
 
84
        State() *state.State
 
85
 
 
86
        // AgentConfig returns the agent config for the machine that is being
 
87
        // upgraded.
82
88
        AgentConfig() agent.Config
83
89
}
84
90
 
87
93
        // Work in progress........
88
94
        // Exactly what a context needs is to be determined as the
89
95
        // implementation evolves.
90
 
        st          *api.State
 
96
        api         *api.State
 
97
        st          *state.State
91
98
        agentConfig agent.Config
92
99
}
93
100
 
94
101
// APIState is defined on the Context interface.
95
102
func (c *upgradeContext) APIState() *api.State {
 
103
        return c.api
 
104
}
 
105
 
 
106
// State is defined on the Context interface.
 
107
func (c *upgradeContext) State() *state.State {
96
108
        return c.st
97
109
}
98
110
 
102
114
}
103
115
 
104
116
// NewContext returns a new upgrade context.
105
 
func NewContext(agentConfig agent.Config, st *api.State) Context {
 
117
func NewContext(agentConfig agent.Config, api *api.State, st *state.State) Context {
106
118
        return &upgradeContext{
 
119
                api:         api,
107
120
                st:          st,
108
121
                agentConfig: agentConfig,
109
122
        }
146
159
// validTarget returns true if target is in step.Targets().
147
160
func validTarget(target Target, step Step) bool {
148
161
        for _, opTarget := range step.Targets() {
149
 
                if target == AllMachines || target == opTarget {
 
162
                if opTarget == AllMachines || target == opTarget {
150
163
                        return true
151
164
                }
152
165
        }