~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/upgrader/upgrader.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
        "github.com/juju/utils"
15
15
        "github.com/juju/utils/arch"
16
16
        "github.com/juju/utils/series"
 
17
        "github.com/juju/version"
17
18
 
18
19
        "github.com/juju/juju/agent"
19
20
        agenttools "github.com/juju/juju/agent/tools"
20
21
        "github.com/juju/juju/api/upgrader"
21
22
        coretools "github.com/juju/juju/tools"
22
 
        "github.com/juju/juju/version"
 
23
        jujuversion "github.com/juju/juju/version"
23
24
        "github.com/juju/juju/worker/catacomb"
24
25
        "github.com/juju/juju/worker/gate"
25
26
)
115
116
func (u *Upgrader) loop() error {
116
117
        // Start by reporting current tools (which includes arch/series, and is
117
118
        // used by the controller in communicating the desired version below).
118
 
        if err := u.st.SetVersion(u.tag.String(), toBinaryVersion(version.Current)); err != nil {
 
119
        if err := u.st.SetVersion(u.tag.String(), toBinaryVersion(jujuversion.Current)); err != nil {
119
120
                return errors.Annotate(err, "cannot set agent version")
120
121
        }
121
122
 
174
175
                }
175
176
                logger.Infof("desired tool version: %v", wantVersion)
176
177
 
177
 
                if wantVersion == version.Current {
 
178
                if wantVersion == jujuversion.Current {
178
179
                        u.initialUpgradeCheckComplete.Unlock()
179
180
                        continue
180
181
                } else if !allowedTargetVersion(
181
182
                        u.origAgentVersion,
182
 
                        version.Current,
 
183
                        jujuversion.Current,
183
184
                        !u.upgradeStepsWaiter.IsUnlocked(),
184
185
                        wantVersion,
185
186
                ) {
189
190
                        // downgrade when its associate machine agent has not
190
191
                        // finished upgrading.
191
192
                        logger.Infof("desired tool version: %s is older than current %s, refusing to downgrade",
192
 
                                wantVersion, version.Current)
 
193
                                wantVersion, jujuversion.Current)
193
194
                        u.initialUpgradeCheckComplete.Unlock()
194
195
                        continue
195
196
                }
196
 
                logger.Infof("upgrade requested from %v to %v", version.Current, wantVersion)
 
197
                logger.Infof("upgrade requested from %v to %v", jujuversion.Current, wantVersion)
197
198
 
198
199
                // Check if tools have already been downloaded.
199
200
                wantVersionBinary := toBinaryVersion(wantVersion)
237
238
 
238
239
func (u *Upgrader) newUpgradeReadyError(newVersion version.Binary) *UpgradeReadyError {
239
240
        return &UpgradeReadyError{
240
 
                OldTools:  toBinaryVersion(version.Current),
 
241
                OldTools:  toBinaryVersion(jujuversion.Current),
241
242
                NewTools:  newVersion,
242
243
                AgentName: u.tag.String(),
243
244
                DataDir:   u.dataDir,