LEFT | RIGHT |
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 common | 4 package common |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 "io" | 8 "io" |
9 "os" | 9 "os" |
10 "path" | 10 "path" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 defer ctx.StopInterruptNotify(ch) | 121 defer ctx.StopInterruptNotify(ch) |
122 defer close(ch) | 122 defer close(ch) |
123 go func() { | 123 go func() { |
124 for _ = range ch { | 124 for _ = range ch { |
125 fmt.Fprintln(ctx.GetStderr(), "Cleaning up failed bootst
rap") | 125 fmt.Fprintln(ctx.GetStderr(), "Cleaning up failed bootst
rap") |
126 } | 126 } |
127 }() | 127 }() |
128 | 128 |
129 if inst != nil { | 129 if inst != nil { |
130 fmt.Fprintln(ctx.GetStderr(), "Stopping instance...") | 130 fmt.Fprintln(ctx.GetStderr(), "Stopping instance...") |
131 » » if stoperr := env.StopInstances([]instance.Id{inst.Id()}); stope
rr != nil { | 131 » » if stoperr := env.StopInstances(inst.Id()); stoperr != nil { |
132 logger.Errorf("cannot stop failed bootstrap instance %q:
%v", inst.Id(), stoperr) | 132 logger.Errorf("cannot stop failed bootstrap instance %q:
%v", inst.Id(), stoperr) |
133 } else { | 133 } else { |
134 // set to nil so we know we can safely delete the state
file | 134 // set to nil so we know we can safely delete the state
file |
135 inst = nil | 135 inst = nil |
136 } | 136 } |
137 } | 137 } |
138 // We only delete the bootstrap state file if either we didn't | 138 // We only delete the bootstrap state file if either we didn't |
139 // start an instance, or we managed to cleanly stop it. | 139 // start an instance, or we managed to cleanly stop it. |
140 if inst == nil { | 140 if inst == nil { |
141 if rmerr := bootstrap.DeleteStateFile(env.Storage()); rmerr != n
il { | 141 if rmerr := bootstrap.DeleteStateFile(env.Storage()); rmerr != n
il { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // EnsureBootstrapTools finds tools, syncing with an external tools source as | 398 // EnsureBootstrapTools finds tools, syncing with an external tools source as |
399 // necessary; it then selects the newest tools to bootstrap with, and sets | 399 // necessary; it then selects the newest tools to bootstrap with, and sets |
400 // agent-version. | 400 // agent-version. |
401 func EnsureBootstrapTools(ctx environs.BootstrapContext, env environs.Environ, s
eries string, arch *string) (coretools.List, error) { | 401 func EnsureBootstrapTools(ctx environs.BootstrapContext, env environs.Environ, s
eries string, arch *string) (coretools.List, error) { |
402 possibleTools, err := bootstrap.EnsureToolsAvailability(ctx, env, series
, arch) | 402 possibleTools, err := bootstrap.EnsureToolsAvailability(ctx, env, series
, arch) |
403 if err != nil { | 403 if err != nil { |
404 return nil, err | 404 return nil, err |
405 } | 405 } |
406 return bootstrap.SetBootstrapTools(env, possibleTools) | 406 return bootstrap.SetBootstrapTools(env, possibleTools) |
407 } | 407 } |
LEFT | RIGHT |