OLD | NEW |
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 "fmt" | 7 "fmt" |
8 "os" | 8 "os" |
9 "strings" | 9 "strings" |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Run connects to the environment specified on the command line and bootstraps | 107 // Run connects to the environment specified on the command line and bootstraps |
108 // a juju in that environment if none already exists. If there is as yet no envi
ronments.yaml file, | 108 // a juju in that environment if none already exists. If there is as yet no envi
ronments.yaml file, |
109 // the user is informed how to create one. | 109 // the user is informed how to create one. |
110 func (c *BootstrapCommand) Run(ctx *cmd.Context) (resultErr error) { | 110 func (c *BootstrapCommand) Run(ctx *cmd.Context) (resultErr error) { |
111 store, err := configstore.Default() | 111 store, err := configstore.Default() |
112 if err != nil { | 112 if err != nil { |
113 return err | 113 return err |
114 } | 114 } |
115 var existing bool | 115 var existing bool |
116 » if _, err := store.ReadInfo(c.EnvName); !errors.IsNotFoundError(err) { | 116 » if environInfo, err := store.ReadInfo(c.EnvName); !errors.IsNotFoundErro
r(err) { |
117 existing = true | 117 existing = true |
| 118 logger.Warningf("ignoring environments.yaml: using bootstrap con
fig in %s", environInfo.Location()) |
118 } | 119 } |
119 environ, err := environs.PrepareFromName(c.EnvName, ctx, store) | 120 environ, err := environs.PrepareFromName(c.EnvName, ctx, store) |
120 if err != nil { | 121 if err != nil { |
121 return err | 122 return err |
122 } | 123 } |
123 if !existing { | 124 if !existing { |
124 defer destroyPreparedEnviron(environ, store, &resultErr, "Bootst
rap") | 125 defer destroyPreparedEnviron(environ, store, &resultErr, "Bootst
rap") |
125 } | 126 } |
126 if err := bootstrap.EnsureNotBootstrapped(environ); err != nil { | 127 if err := bootstrap.EnsureNotBootstrapped(environ); err != nil { |
127 return err | 128 return err |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // probably upload, based on cfg. | 203 // probably upload, based on cfg. |
203 func getUploadSeries(cfg *config.Config, series []string) []string { | 204 func getUploadSeries(cfg *config.Config, series []string) []string { |
204 unique := set.NewStrings(series...) | 205 unique := set.NewStrings(series...) |
205 if unique.IsEmpty() { | 206 if unique.IsEmpty() { |
206 unique.Add(version.Current.Series) | 207 unique.Add(version.Current.Series) |
207 unique.Add(config.DefaultSeries) | 208 unique.Add(config.DefaultSeries) |
208 unique.Add(cfg.DefaultSeries()) | 209 unique.Add(cfg.DefaultSeries()) |
209 } | 210 } |
210 return unique.Values() | 211 return unique.Values() |
211 } | 212 } |
OLD | NEW |