Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1273)

Delta Between Two Patch Sets: cmd/juju/upgradejuju.go

Issue 21940044: cmd/juju: upgrade-juju uses the API (Closed)
Left Patch Set: Created 10 years, 4 months ago
Right Patch Set: cmd/juju: upgrade-juju uses the API Created 10 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « [revision details] ('k') | state/api/client.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package main 4 package main
5 5
6 import ( 6 import (
7 stderrors "errors" 7 stderrors "errors"
8 "fmt" 8 "fmt"
9 9
10 "launchpad.net/gnuflag" 10 "launchpad.net/gnuflag"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 func (c *UpgradeJujuCommand) initVersions(cfg *config.Config, env environs.Envir on) (*upgradeVersions, error) { 165 func (c *UpgradeJujuCommand) initVersions(cfg *config.Config, env environs.Envir on) (*upgradeVersions, error) {
166 agent, ok := cfg.AgentVersion() 166 agent, ok := cfg.AgentVersion()
167 if !ok { 167 if !ok {
168 // Can't happen. In theory. 168 // Can't happen. In theory.
169 return nil, fmt.Errorf("incomplete environment configuration") 169 return nil, fmt.Errorf("incomplete environment configuration")
170 } 170 }
171 if c.Version == agent { 171 if c.Version == agent {
172 return nil, errUpToDate 172 return nil, errUpToDate
173 } 173 }
174 client := version.Current.Number 174 client := version.Current.Number
175 // TODO use an API call rather than requiring the environment,
176 // so that we can restrict access to the provider secrets
177 // while still allowing users to upgrade.
175 available, err := envtools.FindTools(env, client.Major, -1, coretools.Fi lter{}, envtools.DoNotAllowRetry) 178 available, err := envtools.FindTools(env, client.Major, -1, coretools.Fi lter{}, envtools.DoNotAllowRetry)
rog 2013/11/19 12:37:58 // TODO use an API call rather than requiring the
dimitern 2013/11/19 16:15:27 Done.
176 if err != nil { 179 if err != nil {
177 if !errors.IsNotFoundError(err) { 180 if !errors.IsNotFoundError(err) {
178 return nil, err 181 return nil, err
179 } 182 }
180 if !c.UploadTools { 183 if !c.UploadTools {
181 // No tools found and we shouldn't upload any, so preten d 184 // No tools found and we shouldn't upload any, so preten d
182 // there is no more recent version available. 185 // there is no more recent version available.
183 if c.Version == version.Zero { 186 if c.Version == version.Zero {
184 return nil, errUpToDate 187 return nil, errUpToDate
185 } 188 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 for _, t := range existing { 306 for _, t := range existing {
304 if t.Version.Major != vers.Major || t.Version.Minor != vers.Mino r || t.Version.Patch != vers.Patch { 307 if t.Version.Major != vers.Major || t.Version.Minor != vers.Mino r || t.Version.Patch != vers.Patch {
305 continue 308 continue
306 } 309 }
307 if t.Version.Build >= vers.Build { 310 if t.Version.Build >= vers.Build {
308 vers.Build = t.Version.Build + 1 311 vers.Build = t.Version.Build + 1
309 } 312 }
310 } 313 }
311 return vers 314 return vers
312 } 315 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b