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

Delta Between Two Patch Sets: agent/agent.go

Issue 68990043: System SSH key upgrader (Closed)
Left Patch Set: System SSH key upgrader Created 11 years, 1 month ago
Right Patch Set: System SSH key upgrader Created 11 years, 1 month 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:
Right: Side by side diff | Download
« no previous file with change/comment | « [revision details] ('k') | agent/agent_test.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
(no file at all)
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 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 agent 4 package agent
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "path" 8 "path"
9 "regexp" 9 "regexp"
10 "sync" 10 "sync"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 401 }
402 402
403 func (c *configInternal) Write() error { 403 func (c *configInternal) Write() error {
404 // Lock is taken prior to generating any content to write. 404 // Lock is taken prior to generating any content to write.
405 configMutex.Lock() 405 configMutex.Lock()
406 defer configMutex.Unlock() 406 defer configMutex.Unlock()
407 return currentFormatter.write(c) 407 return currentFormatter.write(c)
408 } 408 }
409 409
410 func (c *configInternal) WriteUpgradedToVersion(newVersion version.Number) error { 410 func (c *configInternal) WriteUpgradedToVersion(newVersion version.Number) error {
411 originalVersion := c.upgradedToVersion
411 c.upgradedToVersion = newVersion 412 c.upgradedToVersion = newVersion
412 » return c.Write() 413 » err := c.Write()
414 » if err != nil {
415 » » // We don't want to retain the new version if there's been an er ror writing the file.
416 » » c.upgradedToVersion = originalVersion
417 » }
418 » return err
413 } 419 }
414 420
415 func (c *configInternal) WriteCommands() ([]string, error) { 421 func (c *configInternal) WriteCommands() ([]string, error) {
416 return currentFormatter.writeCommands(c) 422 return currentFormatter.writeCommands(c)
417 } 423 }
418 424
419 func (c *configInternal) OpenAPI(dialOpts api.DialOpts) (st *api.State, newPassw ord string, err error) { 425 func (c *configInternal) OpenAPI(dialOpts api.DialOpts) (st *api.State, newPassw ord string, err error) {
420 info := api.Info{ 426 info := api.Info{
421 Addrs: c.apiDetails.addresses, 427 Addrs: c.apiDetails.addresses,
422 Password: c.apiDetails.password, 428 Password: c.apiDetails.password,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 } 473 }
468 // TODO(rog) remove this fallback behaviour when 474 // TODO(rog) remove this fallback behaviour when
469 // all initial connections are via the API. 475 // all initial connections are via the API.
470 if !errors.IsUnauthorizedError(err) { 476 if !errors.IsUnauthorizedError(err) {
471 return nil, err 477 return nil, err
472 } 478 }
473 } 479 }
474 info.Password = c.oldPassword 480 info.Password = c.oldPassword
475 return state.Open(&info, state.DefaultDialOpts(), policy) 481 return state.Open(&info, state.DefaultDialOpts(), policy)
476 } 482 }
LEFTRIGHT

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