Merge lp:~axwalk/juju-core/lp1237709-bootstrap-placement into lp:~go-bot/juju-core/trunk
- lp1237709-bootstrap-placement
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Andrew Wilkins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2674 |
Proposed branch: | lp:~axwalk/juju-core/lp1237709-bootstrap-placement |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
1076 lines (+155/-109) 33 files modified
cmd/juju/bootstrap.go (+24/-2) cmd/juju/bootstrap_test.go (+11/-5) cmd/juju/cmd_test.go (+0/-5) cmd/juju/deploy_test.go (+3/-0) cmd/plugins/juju-restore/restore.go (+2/-1) environs/bootstrap/bootstrap.go (+2/-3) environs/bootstrap/bootstrap_test.go (+25/-15) environs/interface.go (+12/-4) environs/jujutest/livetests.go (+2/-2) environs/jujutest/tests.go (+2/-3) environs/open_test.go (+1/-2) instance/placement.go (+1/-1) juju/apiconn_test.go (+2/-3) juju/conn_test.go (+6/-6) juju/testing/conn.go (+1/-2) provider/azure/environ.go (+2/-2) provider/common/bootstrap.go (+4/-4) provider/common/bootstrap_test.go (+13/-8) provider/common/mock_test.go (+2/-1) provider/dummy/environs.go (+7/-7) provider/ec2/ec2.go (+2/-2) provider/ec2/local_test.go (+4/-4) provider/joyent/environ.go (+2/-2) provider/joyent/local_test.go (+3/-3) provider/local/config_test.go (+2/-2) provider/local/environ.go (+2/-2) provider/local/environ_test.go (+1/-1) provider/maas/environ.go (+2/-2) provider/maas/environ_whitebox_test.go (+4/-4) provider/manual/environ.go (+2/-1) provider/openstack/live_test.go (+1/-2) provider/openstack/local_test.go (+6/-6) provider/openstack/provider.go (+2/-2) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1237709-bootstrap-placement |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+216971@code.launchpad.net |
Commit message
Support placement directives on bootstrap
juju bootstrap will accept a single, optional
positional argument that will be parsed as a
placement directive. We currently only allow
unscoped placement directives at bootstrap.
Description of the change
Support placement directives on bootstrap
juju bootstrap will accept a single, optional
positional argument that will be parsed as a
placement directive. We currently only allow
unscoped placement directives at bootstrap.
Andrew Wilkins (axwalk) wrote : | # |
Ian Booth (wallyworld) wrote : | # |
LGTM with a suggestion.
Also a drive by fix for
// Directive is a scope-specific placement idrective
would be great.
https:/
File cmd/juju/
https:/
cmd/juju/
What happens if there's a different error other than
ErrPlacementSco
In that case we should just return that other error shouldn't we? ie
there's a difference between an unsupported placement directive and a
placement directive that doesn't parse due to some other error. Even if
there's no other error that can be returned (yet), reworking the
conditional would make it explicit that we are only interested in a
specific case.
Andrew Wilkins (axwalk) wrote : | # |
Please take a look.
https:/
File cmd/juju/
https:/
cmd/juju/
On 2014/04/24 03:10:01, wallyworld wrote:
> What happens if there's a different error other than
ErrPlacementSco
> In that case we should just return that other error shouldn't we? ie
there's a
> difference between an unsupported placement directive and a placement
directive
> that doesn't parse due to some other error. Even if there's no other
error that
> can be returned (yet), reworking the conditional would make it
explicit that we
> are only interested in a specific case.
There are other errors, but they're not meaningful to us if we don't
support scoped placements. For example, lxc:non-numeric will fail to
parse, but we bootstrap doesn't care about why; it only cares that
"lxc:anything" is not supported by bootstrap.
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~axwalk/juju-core/lp1237709-bootstrap-placement into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
? launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
? launchpad.
Preview Diff
1 | === modified file 'cmd/juju/bootstrap.go' | |||
2 | --- cmd/juju/bootstrap.go 2014-04-18 13:49:33 +0000 | |||
3 | +++ cmd/juju/bootstrap.go 2014-04-24 03:34:13 +0000 | |||
4 | @@ -14,9 +14,11 @@ | |||
5 | 14 | "launchpad.net/juju-core/cmd" | 14 | "launchpad.net/juju-core/cmd" |
6 | 15 | "launchpad.net/juju-core/cmd/envcmd" | 15 | "launchpad.net/juju-core/cmd/envcmd" |
7 | 16 | "launchpad.net/juju-core/constraints" | 16 | "launchpad.net/juju-core/constraints" |
8 | 17 | "launchpad.net/juju-core/environs" | ||
9 | 17 | "launchpad.net/juju-core/environs/bootstrap" | 18 | "launchpad.net/juju-core/environs/bootstrap" |
10 | 18 | "launchpad.net/juju-core/environs/imagemetadata" | 19 | "launchpad.net/juju-core/environs/imagemetadata" |
11 | 19 | "launchpad.net/juju-core/environs/tools" | 20 | "launchpad.net/juju-core/environs/tools" |
12 | 21 | "launchpad.net/juju-core/instance" | ||
13 | 20 | "launchpad.net/juju-core/provider" | 22 | "launchpad.net/juju-core/provider" |
14 | 21 | ) | 23 | ) |
15 | 22 | 24 | ||
16 | @@ -64,11 +66,13 @@ | |||
17 | 64 | UploadTools bool | 66 | UploadTools bool |
18 | 65 | Series []string | 67 | Series []string |
19 | 66 | MetadataSource string | 68 | MetadataSource string |
20 | 69 | Placement string | ||
21 | 67 | } | 70 | } |
22 | 68 | 71 | ||
23 | 69 | func (c *BootstrapCommand) Info() *cmd.Info { | 72 | func (c *BootstrapCommand) Info() *cmd.Info { |
24 | 70 | return &cmd.Info{ | 73 | return &cmd.Info{ |
25 | 71 | Name: "bootstrap", | 74 | Name: "bootstrap", |
26 | 75 | Args: "[placement]", | ||
27 | 72 | Purpose: "start up an environment from scratch", | 76 | Purpose: "start up an environment from scratch", |
28 | 73 | Doc: bootstrapDoc, | 77 | Doc: bootstrapDoc, |
29 | 74 | } | 78 | } |
30 | @@ -90,7 +94,22 @@ | |||
31 | 90 | if len(c.Series) > 0 && !c.UploadTools { | 94 | if len(c.Series) > 0 && !c.UploadTools { |
32 | 91 | return fmt.Errorf("--series requires --upload-tools") | 95 | return fmt.Errorf("--series requires --upload-tools") |
33 | 92 | } | 96 | } |
35 | 93 | return cmd.CheckEmpty(args) | 97 | // Parse the placement directive. Bootstrap currently only |
36 | 98 | // supports provider-specific placement directives. | ||
37 | 99 | placement, err := cmd.ZeroOrOneArgs(args) | ||
38 | 100 | if err != nil { | ||
39 | 101 | return err | ||
40 | 102 | } | ||
41 | 103 | if placement == "" { | ||
42 | 104 | return nil | ||
43 | 105 | } | ||
44 | 106 | _, err = instance.ParsePlacement(placement) | ||
45 | 107 | if err != instance.ErrPlacementScopeMissing { | ||
46 | 108 | // We only support unscoped placement directives for bootstrap. | ||
47 | 109 | return fmt.Errorf("unsupported bootstrap placement directive %q", placement) | ||
48 | 110 | } | ||
49 | 111 | c.Placement = placement | ||
50 | 112 | return nil | ||
51 | 94 | } | 113 | } |
52 | 95 | 114 | ||
53 | 96 | // Run connects to the environment specified on the command line and bootstraps | 115 | // Run connects to the environment specified on the command line and bootstraps |
54 | @@ -153,7 +172,10 @@ | |||
55 | 153 | return err | 172 | return err |
56 | 154 | } | 173 | } |
57 | 155 | } | 174 | } |
59 | 156 | return bootstrap.Bootstrap(ctx, environ, c.Constraints) | 175 | return bootstrap.Bootstrap(ctx, environ, environs.BootstrapParams{ |
60 | 176 | Constraints: c.Constraints, | ||
61 | 177 | Placement: c.Placement, | ||
62 | 178 | }) | ||
63 | 157 | } | 179 | } |
64 | 158 | 180 | ||
65 | 159 | type seriesVar struct { | 181 | type seriesVar struct { |
66 | 160 | 182 | ||
67 | === modified file 'cmd/juju/bootstrap_test.go' | |||
68 | --- cmd/juju/bootstrap_test.go 2014-04-21 23:10:05 +0000 | |||
69 | +++ cmd/juju/bootstrap_test.go 2014-04-24 03:34:13 +0000 | |||
70 | @@ -193,6 +193,7 @@ | |||
71 | 193 | // will be uploaded before running the test. | 193 | // will be uploaded before running the test. |
72 | 194 | uploads []string | 194 | uploads []string |
73 | 195 | constraints constraints.Value | 195 | constraints constraints.Value |
74 | 196 | placement string | ||
75 | 196 | hostArch string | 197 | hostArch string |
76 | 197 | } | 198 | } |
77 | 198 | 199 | ||
78 | @@ -271,7 +272,8 @@ | |||
79 | 271 | 272 | ||
80 | 272 | opBootstrap := (<-opc).(dummy.OpBootstrap) | 273 | opBootstrap := (<-opc).(dummy.OpBootstrap) |
81 | 273 | c.Check(opBootstrap.Env, gc.Equals, "peckham") | 274 | c.Check(opBootstrap.Env, gc.Equals, "peckham") |
83 | 274 | c.Check(opBootstrap.Constraints, gc.DeepEquals, test.constraints) | 275 | c.Check(opBootstrap.Args.Constraints, gc.DeepEquals, test.constraints) |
84 | 276 | c.Check(opBootstrap.Args.Placement, gc.Equals, test.placement) | ||
85 | 275 | 277 | ||
86 | 276 | store, err := configstore.Default() | 278 | store, err := configstore.Default() |
87 | 277 | c.Assert(err, gc.IsNil) | 279 | c.Assert(err, gc.IsNil) |
88 | @@ -287,10 +289,6 @@ | |||
89 | 287 | var bootstrapTests = []bootstrapTest{{ | 289 | var bootstrapTests = []bootstrapTest{{ |
90 | 288 | info: "no args, no error, no uploads, no constraints", | 290 | info: "no args, no error, no uploads, no constraints", |
91 | 289 | }, { | 291 | }, { |
92 | 290 | info: "bad arg", | ||
93 | 291 | args: []string{"twiddle"}, | ||
94 | 292 | err: `unrecognized args: \["twiddle"\]`, | ||
95 | 293 | }, { | ||
96 | 294 | info: "bad --constraints", | 292 | info: "bad --constraints", |
97 | 295 | args: []string{"--constraints", "bad=wrong"}, | 293 | args: []string{"--constraints", "bad=wrong"}, |
98 | 296 | err: `invalid value "bad=wrong" for flag --constraints: unknown constraint "bad"`, | 294 | err: `invalid value "bad=wrong" for flag --constraints: unknown constraint "bad"`, |
99 | @@ -372,6 +370,14 @@ | |||
100 | 372 | "1.2.3.5-raring-amd64", | 370 | "1.2.3.5-raring-amd64", |
101 | 373 | "1.2.3.5-%LTS%-amd64", | 371 | "1.2.3.5-%LTS%-amd64", |
102 | 374 | }, | 372 | }, |
103 | 373 | }, { | ||
104 | 374 | info: "placement", | ||
105 | 375 | args: []string{"something"}, | ||
106 | 376 | placement: "something", | ||
107 | 377 | }, { | ||
108 | 378 | info: "invalid placement: ssh", | ||
109 | 379 | args: []string{"ssh:someplace"}, | ||
110 | 380 | err: `unsupported bootstrap placement directive "ssh:someplace"`, | ||
111 | 375 | }} | 381 | }} |
112 | 376 | 382 | ||
113 | 377 | func (s *BootstrapSuite) TestBootstrapTwice(c *gc.C) { | 383 | func (s *BootstrapSuite) TestBootstrapTwice(c *gc.C) { |
114 | 378 | 384 | ||
115 | === modified file 'cmd/juju/cmd_test.go' | |||
116 | --- cmd/juju/cmd_test.go 2014-03-28 12:28:30 +0000 | |||
117 | +++ cmd/juju/cmd_test.go 2014-04-24 03:34:13 +0000 | |||
118 | @@ -114,11 +114,6 @@ | |||
119 | 114 | testInit(c, com, args, "") | 114 | testInit(c, com, args, "") |
120 | 115 | os.Setenv(osenv.JujuEnvEnvKey, oldenv) | 115 | os.Setenv(osenv.JujuEnvEnvKey, oldenv) |
121 | 116 | assertConnName(c, com, "walthamstow") | 116 | assertConnName(c, com, "walthamstow") |
122 | 117 | |||
123 | 118 | com, args = cmdFunc() | ||
124 | 119 | if _, ok := com.(*StatusCommand); !ok { | ||
125 | 120 | testInit(c, com, append(args, "hotdog"), "unrecognized args.*") | ||
126 | 121 | } | ||
127 | 122 | } | 117 | } |
128 | 123 | } | 118 | } |
129 | 124 | 119 | ||
130 | 125 | 120 | ||
131 | === modified file 'cmd/juju/deploy_test.go' | |||
132 | --- cmd/juju/deploy_test.go 2014-04-14 12:36:13 +0000 | |||
133 | +++ cmd/juju/deploy_test.go 2014-04-24 03:34:13 +0000 | |||
134 | @@ -37,6 +37,9 @@ | |||
135 | 37 | args: nil, | 37 | args: nil, |
136 | 38 | err: `no charm specified`, | 38 | err: `no charm specified`, |
137 | 39 | }, { | 39 | }, { |
138 | 40 | args: []string{"charm-name", "service-name", "hotdog"}, | ||
139 | 41 | err: `unrecognized args: \["hotdog"\]`, | ||
140 | 42 | }, { | ||
141 | 40 | args: []string{"craz~ness"}, | 43 | args: []string{"craz~ness"}, |
142 | 41 | err: `invalid charm name "craz~ness"`, | 44 | err: `invalid charm name "craz~ness"`, |
143 | 42 | }, { | 45 | }, { |
144 | 43 | 46 | ||
145 | === modified file 'cmd/plugins/juju-restore/restore.go' | |||
146 | --- cmd/plugins/juju-restore/restore.go 2014-04-12 05:53:58 +0000 | |||
147 | +++ cmd/plugins/juju-restore/restore.go 2014-04-24 03:34:13 +0000 | |||
148 | @@ -254,7 +254,8 @@ | |||
149 | 254 | // error-prone) or we could provide a --no-check flag to make | 254 | // error-prone) or we could provide a --no-check flag to make |
150 | 255 | // it go ahead anyway without the check. | 255 | // it go ahead anyway without the check. |
151 | 256 | 256 | ||
153 | 257 | if err := bootstrap.Bootstrap(ctx, env, cons); err != nil { | 257 | args := environs.BootstrapParams{Constraints: cons} |
154 | 258 | if err := bootstrap.Bootstrap(ctx, env, args); err != nil { | ||
155 | 258 | return nil, fmt.Errorf("cannot bootstrap new instance: %v", err) | 259 | return nil, fmt.Errorf("cannot bootstrap new instance: %v", err) |
156 | 259 | } | 260 | } |
157 | 260 | return env, nil | 261 | return env, nil |
158 | 261 | 262 | ||
159 | === modified file 'environs/bootstrap/bootstrap.go' | |||
160 | --- environs/bootstrap/bootstrap.go 2014-04-17 10:09:39 +0000 | |||
161 | +++ environs/bootstrap/bootstrap.go 2014-04-24 03:34:13 +0000 | |||
162 | @@ -8,7 +8,6 @@ | |||
163 | 8 | 8 | ||
164 | 9 | "github.com/juju/loggo" | 9 | "github.com/juju/loggo" |
165 | 10 | 10 | ||
166 | 11 | "launchpad.net/juju-core/constraints" | ||
167 | 12 | "launchpad.net/juju-core/environs" | 11 | "launchpad.net/juju-core/environs" |
168 | 13 | coretools "launchpad.net/juju-core/tools" | 12 | coretools "launchpad.net/juju-core/tools" |
169 | 14 | "launchpad.net/juju-core/utils/ssh" | 13 | "launchpad.net/juju-core/utils/ssh" |
170 | @@ -20,7 +19,7 @@ | |||
171 | 20 | // Bootstrap bootstraps the given environment. The supplied constraints are | 19 | // Bootstrap bootstraps the given environment. The supplied constraints are |
172 | 21 | // used to provision the instance, and are also set within the bootstrapped | 20 | // used to provision the instance, and are also set within the bootstrapped |
173 | 22 | // environment. | 21 | // environment. |
175 | 23 | func Bootstrap(ctx environs.BootstrapContext, environ environs.Environ, cons constraints.Value) error { | 22 | func Bootstrap(ctx environs.BootstrapContext, environ environs.Environ, args environs.BootstrapParams) error { |
176 | 24 | cfg := environ.Config() | 23 | cfg := environ.Config() |
177 | 25 | if secret := cfg.AdminSecret(); secret == "" { | 24 | if secret := cfg.AdminSecret(); secret == "" { |
178 | 26 | return fmt.Errorf("environment configuration has no admin-secret") | 25 | return fmt.Errorf("environment configuration has no admin-secret") |
179 | @@ -45,7 +44,7 @@ | |||
180 | 45 | } | 44 | } |
181 | 46 | logger.Debugf("environment %q supports service/machine networks: %v", environ.Name(), environ.SupportNetworks()) | 45 | logger.Debugf("environment %q supports service/machine networks: %v", environ.Name(), environ.SupportNetworks()) |
182 | 47 | logger.Infof("bootstrapping environment %q", environ.Name()) | 46 | logger.Infof("bootstrapping environment %q", environ.Name()) |
184 | 48 | return environ.Bootstrap(ctx, cons) | 47 | return environ.Bootstrap(ctx, args) |
185 | 49 | } | 48 | } |
186 | 50 | 49 | ||
187 | 51 | // SetBootstrapTools returns the newest tools from the given tools list, | 50 | // SetBootstrapTools returns the newest tools from the given tools list, |
188 | 52 | 51 | ||
189 | === modified file 'environs/bootstrap/bootstrap_test.go' | |||
190 | --- environs/bootstrap/bootstrap_test.go 2014-04-17 09:42:34 +0000 | |||
191 | +++ environs/bootstrap/bootstrap_test.go 2014-04-24 03:34:13 +0000 | |||
192 | @@ -70,20 +70,20 @@ | |||
193 | 70 | env.cfg = cfg | 70 | env.cfg = cfg |
194 | 71 | } | 71 | } |
195 | 72 | 72 | ||
197 | 73 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 73 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
198 | 74 | c.Assert(err, gc.ErrorMatches, "environment configuration has no admin-secret") | 74 | c.Assert(err, gc.ErrorMatches, "environment configuration has no admin-secret") |
199 | 75 | 75 | ||
200 | 76 | fixEnv("admin-secret", "whatever") | 76 | fixEnv("admin-secret", "whatever") |
202 | 77 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 77 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
203 | 78 | c.Assert(err, gc.ErrorMatches, "environment configuration has no ca-cert") | 78 | c.Assert(err, gc.ErrorMatches, "environment configuration has no ca-cert") |
204 | 79 | 79 | ||
205 | 80 | fixEnv("ca-cert", coretesting.CACert) | 80 | fixEnv("ca-cert", coretesting.CACert) |
207 | 81 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 81 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
208 | 82 | c.Assert(err, gc.ErrorMatches, "environment configuration has no ca-private-key") | 82 | c.Assert(err, gc.ErrorMatches, "environment configuration has no ca-private-key") |
209 | 83 | 83 | ||
210 | 84 | fixEnv("ca-private-key", coretesting.CAKey) | 84 | fixEnv("ca-private-key", coretesting.CAKey) |
211 | 85 | uploadTools(c, env) | 85 | uploadTools(c, env) |
213 | 86 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 86 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
214 | 87 | c.Assert(err, gc.IsNil) | 87 | c.Assert(err, gc.IsNil) |
215 | 88 | } | 88 | } |
216 | 89 | 89 | ||
217 | @@ -96,20 +96,30 @@ | |||
218 | 96 | func (s *bootstrapSuite) TestBootstrapEmptyConstraints(c *gc.C) { | 96 | func (s *bootstrapSuite) TestBootstrapEmptyConstraints(c *gc.C) { |
219 | 97 | env := newEnviron("foo", useDefaultKeys, nil) | 97 | env := newEnviron("foo", useDefaultKeys, nil) |
220 | 98 | s.setDummyStorage(c, env) | 98 | s.setDummyStorage(c, env) |
222 | 99 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 99 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
223 | 100 | c.Assert(err, gc.IsNil) | 100 | c.Assert(err, gc.IsNil) |
224 | 101 | c.Assert(env.bootstrapCount, gc.Equals, 1) | 101 | c.Assert(env.bootstrapCount, gc.Equals, 1) |
226 | 102 | c.Assert(env.constraints, gc.DeepEquals, constraints.Value{}) | 102 | c.Assert(env.args, gc.DeepEquals, environs.BootstrapParams{}) |
227 | 103 | } | 103 | } |
228 | 104 | 104 | ||
229 | 105 | func (s *bootstrapSuite) TestBootstrapSpecifiedConstraints(c *gc.C) { | 105 | func (s *bootstrapSuite) TestBootstrapSpecifiedConstraints(c *gc.C) { |
230 | 106 | env := newEnviron("foo", useDefaultKeys, nil) | 106 | env := newEnviron("foo", useDefaultKeys, nil) |
231 | 107 | s.setDummyStorage(c, env) | 107 | s.setDummyStorage(c, env) |
232 | 108 | cons := constraints.MustParse("cpu-cores=2 mem=4G") | 108 | cons := constraints.MustParse("cpu-cores=2 mem=4G") |
237 | 109 | err := bootstrap.Bootstrap(coretesting.Context(c), env, cons) | 109 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{Constraints: cons}) |
238 | 110 | c.Assert(err, gc.IsNil) | 110 | c.Assert(err, gc.IsNil) |
239 | 111 | c.Assert(env.bootstrapCount, gc.Equals, 1) | 111 | c.Assert(env.bootstrapCount, gc.Equals, 1) |
240 | 112 | c.Assert(env.constraints, gc.DeepEquals, cons) | 112 | c.Assert(env.args.Constraints, gc.DeepEquals, cons) |
241 | 113 | } | ||
242 | 114 | |||
243 | 115 | func (s *bootstrapSuite) TestBootstrapSpecifiedPlacement(c *gc.C) { | ||
244 | 116 | env := newEnviron("foo", useDefaultKeys, nil) | ||
245 | 117 | s.setDummyStorage(c, env) | ||
246 | 118 | placement := "directive" | ||
247 | 119 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{Placement: placement}) | ||
248 | 120 | c.Assert(err, gc.IsNil) | ||
249 | 121 | c.Assert(env.bootstrapCount, gc.Equals, 1) | ||
250 | 122 | c.Assert(env.args.Placement, gc.DeepEquals, placement) | ||
251 | 113 | } | 123 | } |
252 | 114 | 124 | ||
253 | 115 | var bootstrapSetAgentVersionTests = []envtesting.BootstrapToolsTest{ | 125 | var bootstrapSetAgentVersionTests = []envtesting.BootstrapToolsTest{ |
254 | @@ -179,7 +189,7 @@ | |||
255 | 179 | if test.Arch != "" { | 189 | if test.Arch != "" { |
256 | 180 | cons = constraints.MustParse("arch=" + test.Arch) | 190 | cons = constraints.MustParse("arch=" + test.Arch) |
257 | 181 | } | 191 | } |
259 | 182 | err = bootstrap.Bootstrap(coretesting.Context(c), env, cons) | 192 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{Constraints: cons}) |
260 | 183 | if test.Err != "" { | 193 | if test.Err != "" { |
261 | 184 | c.Check(err, gc.NotNil) | 194 | c.Check(err, gc.NotNil) |
262 | 185 | if err != nil { | 195 | if err != nil { |
263 | @@ -206,7 +216,7 @@ | |||
264 | 206 | env := newEnviron("foo", useDefaultKeys, nil) | 216 | env := newEnviron("foo", useDefaultKeys, nil) |
265 | 207 | s.setDummyStorage(c, env) | 217 | s.setDummyStorage(c, env) |
266 | 208 | envtesting.RemoveFakeTools(c, env.Storage()) | 218 | envtesting.RemoveFakeTools(c, env.Storage()) |
268 | 209 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 219 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
269 | 210 | // bootstrap.Bootstrap leaves it to the provider to | 220 | // bootstrap.Bootstrap leaves it to the provider to |
270 | 211 | // locate bootstrap tools. | 221 | // locate bootstrap tools. |
271 | 212 | c.Assert(err, gc.IsNil) | 222 | c.Assert(err, gc.IsNil) |
272 | @@ -479,7 +489,7 @@ | |||
273 | 479 | 489 | ||
274 | 480 | // The following fields are filled in when Bootstrap is called. | 490 | // The following fields are filled in when Bootstrap is called. |
275 | 481 | bootstrapCount int | 491 | bootstrapCount int |
277 | 482 | constraints constraints.Value | 492 | args environs.BootstrapParams |
278 | 483 | storage storage.Storage | 493 | storage storage.Storage |
279 | 484 | } | 494 | } |
280 | 485 | 495 | ||
281 | @@ -525,9 +535,9 @@ | |||
282 | 525 | return e.name | 535 | return e.name |
283 | 526 | } | 536 | } |
284 | 527 | 537 | ||
286 | 528 | func (e *bootstrapEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 538 | func (e *bootstrapEnviron) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
287 | 529 | e.bootstrapCount++ | 539 | e.bootstrapCount++ |
289 | 530 | e.constraints = cons | 540 | e.args = args |
290 | 531 | return nil | 541 | return nil |
291 | 532 | } | 542 | } |
292 | 533 | 543 | ||
293 | 534 | 544 | ||
294 | === modified file 'environs/interface.go' | |||
295 | --- environs/interface.go 2014-04-22 09:23:39 +0000 | |||
296 | +++ environs/interface.go 2014-04-24 03:34:13 +0000 | |||
297 | @@ -65,6 +65,17 @@ | |||
298 | 65 | Config() *config.Config | 65 | Config() *config.Config |
299 | 66 | } | 66 | } |
300 | 67 | 67 | ||
301 | 68 | // BootstrapParams holds the parameters for bootstrapping an environment. | ||
302 | 69 | type BootstrapParams struct { | ||
303 | 70 | // Constraints are used to choose the initial instance specification, | ||
304 | 71 | // and will be stored in the new environment's state. | ||
305 | 72 | Constraints constraints.Value | ||
306 | 73 | |||
307 | 74 | // Placement, if non-empty, holds an environment-specific placement | ||
308 | 75 | // directive used to choose the initial instance. | ||
309 | 76 | Placement string | ||
310 | 77 | } | ||
311 | 78 | |||
312 | 68 | // An Environ represents a juju environment as specified | 79 | // An Environ represents a juju environment as specified |
313 | 69 | // in the environments.yaml file. | 80 | // in the environments.yaml file. |
314 | 70 | // | 81 | // |
315 | @@ -91,13 +102,10 @@ | |||
316 | 91 | // environment via the juju package, the password hash will be | 102 | // environment via the juju package, the password hash will be |
317 | 92 | // automatically replaced by the real password. | 103 | // automatically replaced by the real password. |
318 | 93 | // | 104 | // |
319 | 94 | // The supplied constraints are used to choose the initial instance | ||
320 | 95 | // specification, and will be stored in the new environment's state. | ||
321 | 96 | // | ||
322 | 97 | // Bootstrap is responsible for selecting the appropriate tools, | 105 | // Bootstrap is responsible for selecting the appropriate tools, |
323 | 98 | // and setting the agent-version configuration attribute prior to | 106 | // and setting the agent-version configuration attribute prior to |
324 | 99 | // bootstrapping the environment. | 107 | // bootstrapping the environment. |
326 | 100 | Bootstrap(ctx BootstrapContext, cons constraints.Value) error | 108 | Bootstrap(ctx BootstrapContext, params BootstrapParams) error |
327 | 101 | 109 | ||
328 | 102 | // StateInfo returns information on the state initialized | 110 | // StateInfo returns information on the state initialized |
329 | 103 | // by Bootstrap. | 111 | // by Bootstrap. |
330 | 104 | 112 | ||
331 | === modified file 'environs/jujutest/livetests.go' | |||
332 | --- environs/jujutest/livetests.go 2014-04-22 09:23:39 +0000 | |||
333 | +++ environs/jujutest/livetests.go 2014-04-24 03:34:13 +0000 | |||
334 | @@ -139,7 +139,7 @@ | |||
335 | 139 | envtesting.UploadFakeTools(c, t.Env.Storage()) | 139 | envtesting.UploadFakeTools(c, t.Env.Storage()) |
336 | 140 | err := bootstrap.EnsureNotBootstrapped(t.Env) | 140 | err := bootstrap.EnsureNotBootstrapped(t.Env) |
337 | 141 | c.Assert(err, gc.IsNil) | 141 | c.Assert(err, gc.IsNil) |
339 | 142 | err = bootstrap.Bootstrap(coretesting.Context(c), t.Env, cons) | 142 | err = bootstrap.Bootstrap(coretesting.Context(c), t.Env, environs.BootstrapParams{Constraints: cons}) |
340 | 143 | c.Assert(err, gc.IsNil) | 143 | c.Assert(err, gc.IsNil) |
341 | 144 | t.bootstrapped = true | 144 | t.bootstrapped = true |
342 | 145 | } | 145 | } |
343 | @@ -917,7 +917,7 @@ | |||
344 | 917 | err = storageCopy(dummyStorage, currentName, envStorage, otherName) | 917 | err = storageCopy(dummyStorage, currentName, envStorage, otherName) |
345 | 918 | c.Assert(err, gc.IsNil) | 918 | c.Assert(err, gc.IsNil) |
346 | 919 | 919 | ||
348 | 920 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 920 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
349 | 921 | c.Assert(err, gc.IsNil) | 921 | c.Assert(err, gc.IsNil) |
350 | 922 | 922 | ||
351 | 923 | conn, err := juju.NewConn(env) | 923 | conn, err := juju.NewConn(env) |
352 | 924 | 924 | ||
353 | === modified file 'environs/jujutest/tests.go' | |||
354 | --- environs/jujutest/tests.go 2014-04-14 12:36:13 +0000 | |||
355 | +++ environs/jujutest/tests.go 2014-04-24 03:34:13 +0000 | |||
356 | @@ -12,7 +12,6 @@ | |||
357 | 12 | jc "github.com/juju/testing/checkers" | 12 | jc "github.com/juju/testing/checkers" |
358 | 13 | gc "launchpad.net/gocheck" | 13 | gc "launchpad.net/gocheck" |
359 | 14 | 14 | ||
360 | 15 | "launchpad.net/juju-core/constraints" | ||
361 | 16 | "launchpad.net/juju-core/environs" | 15 | "launchpad.net/juju-core/environs" |
362 | 17 | "launchpad.net/juju-core/environs/bootstrap" | 16 | "launchpad.net/juju-core/environs/bootstrap" |
363 | 18 | "launchpad.net/juju-core/environs/config" | 17 | "launchpad.net/juju-core/environs/config" |
364 | @@ -133,7 +132,7 @@ | |||
365 | 133 | envtesting.UploadFakeTools(c, e.Storage()) | 132 | envtesting.UploadFakeTools(c, e.Storage()) |
366 | 134 | err := bootstrap.EnsureNotBootstrapped(e) | 133 | err := bootstrap.EnsureNotBootstrapped(e) |
367 | 135 | c.Assert(err, gc.IsNil) | 134 | c.Assert(err, gc.IsNil) |
369 | 136 | err = bootstrap.Bootstrap(coretesting.Context(c), e, constraints.Value{}) | 135 | err = bootstrap.Bootstrap(coretesting.Context(c), e, environs.BootstrapParams{}) |
370 | 137 | c.Assert(err, gc.IsNil) | 136 | c.Assert(err, gc.IsNil) |
371 | 138 | 137 | ||
372 | 139 | info, apiInfo, err := e.StateInfo() | 138 | info, apiInfo, err := e.StateInfo() |
373 | @@ -161,7 +160,7 @@ | |||
374 | 161 | 160 | ||
375 | 162 | err = bootstrap.EnsureNotBootstrapped(e3) | 161 | err = bootstrap.EnsureNotBootstrapped(e3) |
376 | 163 | c.Assert(err, gc.IsNil) | 162 | c.Assert(err, gc.IsNil) |
378 | 164 | err = bootstrap.Bootstrap(coretesting.Context(c), e3, constraints.Value{}) | 163 | err = bootstrap.Bootstrap(coretesting.Context(c), e3, environs.BootstrapParams{}) |
379 | 165 | c.Assert(err, gc.IsNil) | 164 | c.Assert(err, gc.IsNil) |
380 | 166 | 165 | ||
381 | 167 | err = bootstrap.EnsureNotBootstrapped(e3) | 166 | err = bootstrap.EnsureNotBootstrapped(e3) |
382 | 168 | 167 | ||
383 | === modified file 'environs/open_test.go' | |||
384 | --- environs/open_test.go 2014-04-14 12:36:13 +0000 | |||
385 | +++ environs/open_test.go 2014-04-24 03:34:13 +0000 | |||
386 | @@ -10,7 +10,6 @@ | |||
387 | 10 | gc "launchpad.net/gocheck" | 10 | gc "launchpad.net/gocheck" |
388 | 11 | 11 | ||
389 | 12 | "launchpad.net/juju-core/cert" | 12 | "launchpad.net/juju-core/cert" |
390 | 13 | "launchpad.net/juju-core/constraints" | ||
391 | 14 | "launchpad.net/juju-core/environs" | 13 | "launchpad.net/juju-core/environs" |
392 | 15 | "launchpad.net/juju-core/environs/bootstrap" | 14 | "launchpad.net/juju-core/environs/bootstrap" |
393 | 16 | "launchpad.net/juju-core/environs/config" | 15 | "launchpad.net/juju-core/environs/config" |
394 | @@ -41,7 +40,7 @@ | |||
395 | 41 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) | 40 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) |
396 | 42 | c.Assert(err, gc.IsNil) | 41 | c.Assert(err, gc.IsNil) |
397 | 43 | envtesting.UploadFakeTools(c, env.Storage()) | 42 | envtesting.UploadFakeTools(c, env.Storage()) |
399 | 44 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 43 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
400 | 45 | c.Assert(err, gc.IsNil) | 44 | c.Assert(err, gc.IsNil) |
401 | 46 | } | 45 | } |
402 | 47 | 46 | ||
403 | 48 | 47 | ||
404 | === modified file 'instance/placement.go' | |||
405 | --- instance/placement.go 2014-04-23 05:38:27 +0000 | |||
406 | +++ instance/placement.go 2014-04-24 03:34:13 +0000 | |||
407 | @@ -28,7 +28,7 @@ | |||
408 | 28 | // If Scope is empty, then it must be inferred from the context. | 28 | // If Scope is empty, then it must be inferred from the context. |
409 | 29 | Scope string | 29 | Scope string |
410 | 30 | 30 | ||
412 | 31 | // Directive is a scope-specific placement idrective. | 31 | // Directive is a scope-specific placement directive. |
413 | 32 | // | 32 | // |
414 | 33 | // For MachineScope or a container scope, this may be empty or | 33 | // For MachineScope or a container scope, this may be empty or |
415 | 34 | // the ID of an existing machine. | 34 | // the ID of an existing machine. |
416 | 35 | 35 | ||
417 | === modified file 'juju/apiconn_test.go' | |||
418 | --- juju/apiconn_test.go 2014-04-22 14:34:29 +0000 | |||
419 | +++ juju/apiconn_test.go 2014-04-24 03:34:13 +0000 | |||
420 | @@ -11,7 +11,6 @@ | |||
421 | 11 | jc "github.com/juju/testing/checkers" | 11 | jc "github.com/juju/testing/checkers" |
422 | 12 | gc "launchpad.net/gocheck" | 12 | gc "launchpad.net/gocheck" |
423 | 13 | 13 | ||
424 | 14 | "launchpad.net/juju-core/constraints" | ||
425 | 15 | "launchpad.net/juju-core/environs" | 14 | "launchpad.net/juju-core/environs" |
426 | 16 | "launchpad.net/juju-core/environs/bootstrap" | 15 | "launchpad.net/juju-core/environs/bootstrap" |
427 | 17 | "launchpad.net/juju-core/environs/config" | 16 | "launchpad.net/juju-core/environs/config" |
428 | @@ -53,7 +52,7 @@ | |||
429 | 53 | c.Assert(err, gc.IsNil) | 52 | c.Assert(err, gc.IsNil) |
430 | 54 | 53 | ||
431 | 55 | envtesting.UploadFakeTools(c, env.Storage()) | 54 | envtesting.UploadFakeTools(c, env.Storage()) |
433 | 56 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 55 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
434 | 57 | c.Assert(err, gc.IsNil) | 56 | c.Assert(err, gc.IsNil) |
435 | 58 | 57 | ||
436 | 59 | cfg = env.Config() | 58 | cfg = env.Config() |
437 | @@ -601,7 +600,7 @@ | |||
438 | 601 | c.Assert(err, gc.IsNil) | 600 | c.Assert(err, gc.IsNil) |
439 | 602 | defer dummy.Reset() | 601 | defer dummy.Reset() |
440 | 603 | envtesting.UploadFakeTools(c, env.Storage()) | 602 | envtesting.UploadFakeTools(c, env.Storage()) |
442 | 604 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 603 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
443 | 605 | c.Assert(err, gc.IsNil) | 604 | c.Assert(err, gc.IsNil) |
444 | 606 | 605 | ||
445 | 607 | // Note: if we get Bootstrap to start caching the API endpoint | 606 | // Note: if we get Bootstrap to start caching the API endpoint |
446 | 608 | 607 | ||
447 | === modified file 'juju/conn_test.go' | |||
448 | --- juju/conn_test.go 2014-04-14 12:36:13 +0000 | |||
449 | +++ juju/conn_test.go 2014-04-24 03:34:13 +0000 | |||
450 | @@ -70,7 +70,7 @@ | |||
451 | 70 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) | 70 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) |
452 | 71 | c.Assert(err, gc.IsNil) | 71 | c.Assert(err, gc.IsNil) |
453 | 72 | envtesting.UploadFakeTools(c, env.Storage()) | 72 | envtesting.UploadFakeTools(c, env.Storage()) |
455 | 73 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 73 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
456 | 74 | c.Assert(err, gc.IsNil) | 74 | c.Assert(err, gc.IsNil) |
457 | 75 | 75 | ||
458 | 76 | attrs := env.Config().AllAttrs() | 76 | attrs := env.Config().AllAttrs() |
459 | @@ -90,7 +90,7 @@ | |||
460 | 90 | env, err := environs.PrepareFromName(envName, ctx, store) | 90 | env, err := environs.PrepareFromName(envName, ctx, store) |
461 | 91 | c.Assert(err, gc.IsNil) | 91 | c.Assert(err, gc.IsNil) |
462 | 92 | envtesting.UploadFakeTools(c, env.Storage()) | 92 | envtesting.UploadFakeTools(c, env.Storage()) |
464 | 93 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 93 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
465 | 94 | c.Assert(err, gc.IsNil) | 94 | c.Assert(err, gc.IsNil) |
466 | 95 | } | 95 | } |
467 | 96 | 96 | ||
468 | @@ -136,7 +136,7 @@ | |||
469 | 136 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) | 136 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) |
470 | 137 | c.Assert(err, gc.IsNil) | 137 | c.Assert(err, gc.IsNil) |
471 | 138 | envtesting.UploadFakeTools(c, env.Storage()) | 138 | envtesting.UploadFakeTools(c, env.Storage()) |
473 | 139 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 139 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
474 | 140 | c.Assert(err, gc.IsNil) | 140 | c.Assert(err, gc.IsNil) |
475 | 141 | info, _, err := env.StateInfo() | 141 | info, _, err := env.StateInfo() |
476 | 142 | c.Assert(err, gc.IsNil) | 142 | c.Assert(err, gc.IsNil) |
477 | @@ -180,7 +180,7 @@ | |||
478 | 180 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) | 180 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) |
479 | 181 | c.Assert(err, gc.IsNil) | 181 | c.Assert(err, gc.IsNil) |
480 | 182 | envtesting.UploadFakeTools(c, env.Storage()) | 182 | envtesting.UploadFakeTools(c, env.Storage()) |
482 | 183 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 183 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
483 | 184 | c.Assert(err, gc.IsNil) | 184 | c.Assert(err, gc.IsNil) |
484 | 185 | 185 | ||
485 | 186 | // Make a new Conn, which will push the secrets. | 186 | // Make a new Conn, which will push the secrets. |
486 | @@ -217,7 +217,7 @@ | |||
487 | 217 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) | 217 | env, err := environs.Prepare(cfg, ctx, configstore.NewMem()) |
488 | 218 | c.Assert(err, gc.IsNil) | 218 | c.Assert(err, gc.IsNil) |
489 | 219 | envtesting.UploadFakeTools(c, env.Storage()) | 219 | envtesting.UploadFakeTools(c, env.Storage()) |
491 | 220 | err = bootstrap.Bootstrap(ctx, env, constraints.Value{}) | 220 | err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{}) |
492 | 221 | c.Assert(err, gc.IsNil) | 221 | c.Assert(err, gc.IsNil) |
493 | 222 | 222 | ||
494 | 223 | // Check that Bootstrap has correctly used a hash | 223 | // Check that Bootstrap has correctly used a hash |
495 | @@ -272,7 +272,7 @@ | |||
496 | 272 | environ, err := environs.Prepare(cfg, ctx, configstore.NewMem()) | 272 | environ, err := environs.Prepare(cfg, ctx, configstore.NewMem()) |
497 | 273 | c.Assert(err, gc.IsNil) | 273 | c.Assert(err, gc.IsNil) |
498 | 274 | envtesting.UploadFakeTools(c, environ.Storage()) | 274 | envtesting.UploadFakeTools(c, environ.Storage()) |
500 | 275 | err = bootstrap.Bootstrap(ctx, environ, constraints.Value{}) | 275 | err = bootstrap.Bootstrap(ctx, environ, environs.BootstrapParams{}) |
501 | 276 | c.Assert(err, gc.IsNil) | 276 | c.Assert(err, gc.IsNil) |
502 | 277 | s.conn, err = juju.NewConn(environ) | 277 | s.conn, err = juju.NewConn(environ) |
503 | 278 | c.Assert(err, gc.IsNil) | 278 | c.Assert(err, gc.IsNil) |
504 | 279 | 279 | ||
505 | === modified file 'juju/testing/conn.go' | |||
506 | --- juju/testing/conn.go 2014-04-11 17:51:58 +0000 | |||
507 | +++ juju/testing/conn.go 2014-04-24 03:34:13 +0000 | |||
508 | @@ -14,7 +14,6 @@ | |||
509 | 14 | 14 | ||
510 | 15 | "launchpad.net/juju-core/agent" | 15 | "launchpad.net/juju-core/agent" |
511 | 16 | "launchpad.net/juju-core/charm" | 16 | "launchpad.net/juju-core/charm" |
512 | 17 | "launchpad.net/juju-core/constraints" | ||
513 | 18 | "launchpad.net/juju-core/environs" | 17 | "launchpad.net/juju-core/environs" |
514 | 19 | "launchpad.net/juju-core/environs/bootstrap" | 18 | "launchpad.net/juju-core/environs/bootstrap" |
515 | 20 | "launchpad.net/juju-core/environs/config" | 19 | "launchpad.net/juju-core/environs/config" |
516 | @@ -220,7 +219,7 @@ | |||
517 | 220 | 219 | ||
518 | 221 | // Upload tools for both preferred and fake default series | 220 | // Upload tools for both preferred and fake default series |
519 | 222 | envtesting.MustUploadFakeToolsVersions(environ.Storage(), versions...) | 221 | envtesting.MustUploadFakeToolsVersions(environ.Storage(), versions...) |
521 | 223 | c.Assert(bootstrap.Bootstrap(ctx, environ, constraints.Value{}), gc.IsNil) | 222 | c.Assert(bootstrap.Bootstrap(ctx, environ, environs.BootstrapParams{}), gc.IsNil) |
522 | 224 | 223 | ||
523 | 225 | s.BackingState = environ.(GetStater).GetStateInAPIServer() | 224 | s.BackingState = environ.(GetStater).GetStateInAPIServer() |
524 | 226 | 225 | ||
525 | 227 | 226 | ||
526 | === modified file 'provider/azure/environ.go' | |||
527 | --- provider/azure/environ.go 2014-04-22 09:38:55 +0000 | |||
528 | +++ provider/azure/environ.go 2014-04-24 03:34:13 +0000 | |||
529 | @@ -260,7 +260,7 @@ | |||
530 | 260 | } | 260 | } |
531 | 261 | 261 | ||
532 | 262 | // Bootstrap is specified in the Environ interface. | 262 | // Bootstrap is specified in the Environ interface. |
534 | 263 | func (env *azureEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) (err error) { | 263 | func (env *azureEnviron) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) (err error) { |
535 | 264 | // The creation of the affinity group and the virtual network is specific to the Azure provider. | 264 | // The creation of the affinity group and the virtual network is specific to the Azure provider. |
536 | 265 | err = env.createAffinityGroup() | 265 | err = env.createAffinityGroup() |
537 | 266 | if err != nil { | 266 | if err != nil { |
538 | @@ -282,7 +282,7 @@ | |||
539 | 282 | env.deleteVirtualNetwork() | 282 | env.deleteVirtualNetwork() |
540 | 283 | } | 283 | } |
541 | 284 | }() | 284 | }() |
543 | 285 | err = common.Bootstrap(ctx, env, cons) | 285 | err = common.Bootstrap(ctx, env, args) |
544 | 286 | return err | 286 | return err |
545 | 287 | } | 287 | } |
546 | 288 | 288 | ||
547 | 289 | 289 | ||
548 | === modified file 'provider/common/bootstrap.go' | |||
549 | --- provider/common/bootstrap.go 2014-04-11 11:51:08 +0000 | |||
550 | +++ provider/common/bootstrap.go 2014-04-24 03:34:13 +0000 | |||
551 | @@ -15,7 +15,6 @@ | |||
552 | 15 | 15 | ||
553 | 16 | coreCloudinit "launchpad.net/juju-core/cloudinit" | 16 | coreCloudinit "launchpad.net/juju-core/cloudinit" |
554 | 17 | "launchpad.net/juju-core/cloudinit/sshinit" | 17 | "launchpad.net/juju-core/cloudinit/sshinit" |
555 | 18 | "launchpad.net/juju-core/constraints" | ||
556 | 19 | "launchpad.net/juju-core/environs" | 18 | "launchpad.net/juju-core/environs" |
557 | 20 | "launchpad.net/juju-core/environs/bootstrap" | 19 | "launchpad.net/juju-core/environs/bootstrap" |
558 | 21 | "launchpad.net/juju-core/environs/cloudinit" | 20 | "launchpad.net/juju-core/environs/cloudinit" |
559 | @@ -33,7 +32,7 @@ | |||
560 | 33 | // Bootstrap is a common implementation of the Bootstrap method defined on | 32 | // Bootstrap is a common implementation of the Bootstrap method defined on |
561 | 34 | // environs.Environ; we strongly recommend that this implementation be used | 33 | // environs.Environ; we strongly recommend that this implementation be used |
562 | 35 | // when writing a new provider. | 34 | // when writing a new provider. |
564 | 36 | func Bootstrap(ctx environs.BootstrapContext, env environs.Environ, cons constraints.Value) (err error) { | 35 | func Bootstrap(ctx environs.BootstrapContext, env environs.Environ, args environs.BootstrapParams) (err error) { |
565 | 37 | // TODO make safe in the case of racing Bootstraps | 36 | // TODO make safe in the case of racing Bootstraps |
566 | 38 | // If two Bootstraps are called concurrently, there's | 37 | // If two Bootstraps are called concurrently, there's |
567 | 39 | // no way to make sure that only one succeeds. | 38 | // no way to make sure that only one succeeds. |
568 | @@ -42,7 +41,7 @@ | |||
569 | 42 | defer func() { handleBootstrapError(err, ctx, inst, env) }() | 41 | defer func() { handleBootstrapError(err, ctx, inst, env) }() |
570 | 43 | 42 | ||
571 | 44 | // First thing, ensure we have tools otherwise there's no point. | 43 | // First thing, ensure we have tools otherwise there's no point. |
573 | 45 | selectedTools, err := EnsureBootstrapTools(ctx, env, config.PreferredSeries(env.Config()), cons.Arch) | 44 | selectedTools, err := EnsureBootstrapTools(ctx, env, config.PreferredSeries(env.Config()), args.Constraints.Arch) |
574 | 46 | if err != nil { | 45 | if err != nil { |
575 | 47 | return err | 46 | return err |
576 | 48 | } | 47 | } |
577 | @@ -64,9 +63,10 @@ | |||
578 | 64 | 63 | ||
579 | 65 | fmt.Fprintln(ctx.GetStderr(), "Launching instance") | 64 | fmt.Fprintln(ctx.GetStderr(), "Launching instance") |
580 | 66 | inst, hw, _, err := env.StartInstance(environs.StartInstanceParams{ | 65 | inst, hw, _, err := env.StartInstance(environs.StartInstanceParams{ |
582 | 67 | Constraints: cons, | 66 | Constraints: args.Constraints, |
583 | 68 | Tools: selectedTools, | 67 | Tools: selectedTools, |
584 | 69 | MachineConfig: machineConfig, | 68 | MachineConfig: machineConfig, |
585 | 69 | Placement: args.Placement, | ||
586 | 70 | }) | 70 | }) |
587 | 71 | if err != nil { | 71 | if err != nil { |
588 | 72 | return fmt.Errorf("cannot start bootstrap instance: %v", err) | 72 | return fmt.Errorf("cannot start bootstrap instance: %v", err) |
589 | 73 | 73 | ||
590 | === modified file 'provider/common/bootstrap_test.go' | |||
591 | --- provider/common/bootstrap_test.go 2014-04-18 16:37:28 +0000 | |||
592 | +++ provider/common/bootstrap_test.go 2014-04-24 03:34:13 +0000 | |||
593 | @@ -76,13 +76,15 @@ | |||
594 | 76 | } | 76 | } |
595 | 77 | 77 | ||
596 | 78 | func (s *BootstrapSuite) TestCannotStartInstance(c *gc.C) { | 78 | func (s *BootstrapSuite) TestCannotStartInstance(c *gc.C) { |
597 | 79 | checkPlacement := "directive" | ||
598 | 79 | checkCons := constraints.MustParse("mem=8G") | 80 | checkCons := constraints.MustParse("mem=8G") |
599 | 80 | 81 | ||
600 | 81 | startInstance := func( | 82 | startInstance := func( |
602 | 82 | cons constraints.Value, _, _ []string, possibleTools tools.List, mcfg *cloudinit.MachineConfig, | 83 | placement string, cons constraints.Value, _, _ []string, possibleTools tools.List, mcfg *cloudinit.MachineConfig, |
603 | 83 | ) ( | 84 | ) ( |
604 | 84 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, | 85 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, |
605 | 85 | ) { | 86 | ) { |
606 | 87 | c.Assert(placement, gc.DeepEquals, checkPlacement) | ||
607 | 86 | c.Assert(cons, gc.DeepEquals, checkCons) | 88 | c.Assert(cons, gc.DeepEquals, checkCons) |
608 | 87 | c.Assert(mcfg, gc.DeepEquals, environs.NewBootstrapMachineConfig(mcfg.SystemPrivateSSHKey)) | 89 | c.Assert(mcfg, gc.DeepEquals, environs.NewBootstrapMachineConfig(mcfg.SystemPrivateSSHKey)) |
609 | 88 | return nil, nil, nil, fmt.Errorf("meh, not started") | 90 | return nil, nil, nil, fmt.Errorf("meh, not started") |
610 | @@ -95,7 +97,10 @@ | |||
611 | 95 | } | 97 | } |
612 | 96 | 98 | ||
613 | 97 | ctx := coretesting.Context(c) | 99 | ctx := coretesting.Context(c) |
615 | 98 | err := common.Bootstrap(ctx, env, checkCons) | 100 | err := common.Bootstrap(ctx, env, environs.BootstrapParams{ |
616 | 101 | Constraints: checkCons, | ||
617 | 102 | Placement: checkPlacement, | ||
618 | 103 | }) | ||
619 | 99 | c.Assert(err, gc.ErrorMatches, "cannot start bootstrap instance: meh, not started") | 104 | c.Assert(err, gc.ErrorMatches, "cannot start bootstrap instance: meh, not started") |
620 | 100 | } | 105 | } |
621 | 101 | 106 | ||
622 | @@ -104,7 +109,7 @@ | |||
623 | 104 | stor := &mockStorage{Storage: innerStorage} | 109 | stor := &mockStorage{Storage: innerStorage} |
624 | 105 | 110 | ||
625 | 106 | startInstance := func( | 111 | startInstance := func( |
627 | 107 | _ constraints.Value, _, _ []string, _ tools.List, _ *cloudinit.MachineConfig, | 112 | _ string, _ constraints.Value, _, _ []string, _ tools.List, _ *cloudinit.MachineConfig, |
628 | 108 | ) ( | 113 | ) ( |
629 | 109 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, | 114 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, |
630 | 110 | ) { | 115 | ) { |
631 | @@ -126,7 +131,7 @@ | |||
632 | 126 | } | 131 | } |
633 | 127 | 132 | ||
634 | 128 | ctx := coretesting.Context(c) | 133 | ctx := coretesting.Context(c) |
636 | 129 | err := common.Bootstrap(ctx, env, constraints.Value{}) | 134 | err := common.Bootstrap(ctx, env, environs.BootstrapParams{}) |
637 | 130 | c.Assert(err, gc.ErrorMatches, "cannot save state: suddenly a wild blah") | 135 | c.Assert(err, gc.ErrorMatches, "cannot save state: suddenly a wild blah") |
638 | 131 | c.Assert(stopped, gc.HasLen, 1) | 136 | c.Assert(stopped, gc.HasLen, 1) |
639 | 132 | c.Assert(stopped[0].Id(), gc.Equals, instance.Id("i-blah")) | 137 | c.Assert(stopped[0].Id(), gc.Equals, instance.Id("i-blah")) |
640 | @@ -137,7 +142,7 @@ | |||
641 | 137 | stor := &mockStorage{Storage: innerStorage} | 142 | stor := &mockStorage{Storage: innerStorage} |
642 | 138 | 143 | ||
643 | 139 | startInstance := func( | 144 | startInstance := func( |
645 | 140 | _ constraints.Value, _, _ []string, _ tools.List, _ *cloudinit.MachineConfig, | 145 | _ string, _ constraints.Value, _, _ []string, _ tools.List, _ *cloudinit.MachineConfig, |
646 | 141 | ) ( | 146 | ) ( |
647 | 142 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, | 147 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, |
648 | 143 | ) { | 148 | ) { |
649 | @@ -163,7 +168,7 @@ | |||
650 | 163 | } | 168 | } |
651 | 164 | 169 | ||
652 | 165 | ctx := coretesting.Context(c) | 170 | ctx := coretesting.Context(c) |
654 | 166 | err := common.Bootstrap(ctx, env, constraints.Value{}) | 171 | err := common.Bootstrap(ctx, env, environs.BootstrapParams{}) |
655 | 167 | c.Assert(err, gc.ErrorMatches, "cannot save state: suddenly a wild blah") | 172 | c.Assert(err, gc.ErrorMatches, "cannot save state: suddenly a wild blah") |
656 | 168 | c.Assert(stopped, gc.HasLen, 1) | 173 | c.Assert(stopped, gc.HasLen, 1) |
657 | 169 | c.Assert(stopped[0].Id(), gc.Equals, instance.Id("i-blah")) | 174 | c.Assert(stopped[0].Id(), gc.Equals, instance.Id("i-blah")) |
658 | @@ -178,7 +183,7 @@ | |||
659 | 178 | checkHardware := instance.MustParseHardware("mem=2T") | 183 | checkHardware := instance.MustParseHardware("mem=2T") |
660 | 179 | 184 | ||
661 | 180 | startInstance := func( | 185 | startInstance := func( |
663 | 181 | _ constraints.Value, _, _ []string, _ tools.List, mcfg *cloudinit.MachineConfig, | 186 | _ string, _ constraints.Value, _, _ []string, _ tools.List, mcfg *cloudinit.MachineConfig, |
664 | 182 | ) ( | 187 | ) ( |
665 | 183 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, | 188 | instance.Instance, *instance.HardwareCharacteristics, []network.Info, error, |
666 | 184 | ) { | 189 | ) { |
667 | @@ -206,7 +211,7 @@ | |||
668 | 206 | } | 211 | } |
669 | 207 | originalAuthKeys := env.Config().AuthorizedKeys() | 212 | originalAuthKeys := env.Config().AuthorizedKeys() |
670 | 208 | ctx := coretesting.Context(c) | 213 | ctx := coretesting.Context(c) |
672 | 209 | err := common.Bootstrap(ctx, env, constraints.Value{}) | 214 | err := common.Bootstrap(ctx, env, environs.BootstrapParams{}) |
673 | 210 | c.Assert(err, gc.IsNil) | 215 | c.Assert(err, gc.IsNil) |
674 | 211 | 216 | ||
675 | 212 | authKeys := env.Config().AuthorizedKeys() | 217 | authKeys := env.Config().AuthorizedKeys() |
676 | 213 | 218 | ||
677 | === modified file 'provider/common/mock_test.go' | |||
678 | --- provider/common/mock_test.go 2014-04-18 16:37:28 +0000 | |||
679 | +++ provider/common/mock_test.go 2014-04-24 03:34:13 +0000 | |||
680 | @@ -18,7 +18,7 @@ | |||
681 | 18 | ) | 18 | ) |
682 | 19 | 19 | ||
683 | 20 | type allInstancesFunc func() ([]instance.Instance, error) | 20 | type allInstancesFunc func() ([]instance.Instance, error) |
685 | 21 | type startInstanceFunc func(constraints.Value, []string, []string, tools.List, *cloudinit.MachineConfig) (instance.Instance, *instance.HardwareCharacteristics, []network.Info, error) | 21 | type startInstanceFunc func(string, constraints.Value, []string, []string, tools.List, *cloudinit.MachineConfig) (instance.Instance, *instance.HardwareCharacteristics, []network.Info, error) |
686 | 22 | type stopInstancesFunc func([]instance.Instance) error | 22 | type stopInstancesFunc func([]instance.Instance) error |
687 | 23 | type getToolsSourcesFunc func() ([]simplestreams.DataSource, error) | 23 | type getToolsSourcesFunc func() ([]simplestreams.DataSource, error) |
688 | 24 | type configFunc func() *config.Config | 24 | type configFunc func() *config.Config |
689 | @@ -52,6 +52,7 @@ | |||
690 | 52 | } | 52 | } |
691 | 53 | func (env *mockEnviron) StartInstance(args environs.StartInstanceParams) (instance.Instance, *instance.HardwareCharacteristics, []network.Info, error) { | 53 | func (env *mockEnviron) StartInstance(args environs.StartInstanceParams) (instance.Instance, *instance.HardwareCharacteristics, []network.Info, error) { |
692 | 54 | return env.startInstance( | 54 | return env.startInstance( |
693 | 55 | args.Placement, | ||
694 | 55 | args.Constraints, | 56 | args.Constraints, |
695 | 56 | args.MachineConfig.IncludeNetworks, | 57 | args.MachineConfig.IncludeNetworks, |
696 | 57 | args.MachineConfig.ExcludeNetworks, | 58 | args.MachineConfig.ExcludeNetworks, |
697 | 58 | 59 | ||
698 | === modified file 'provider/dummy/environs.go' | |||
699 | --- provider/dummy/environs.go 2014-04-22 09:23:39 +0000 | |||
700 | +++ provider/dummy/environs.go 2014-04-24 03:34:13 +0000 | |||
701 | @@ -98,9 +98,9 @@ | |||
702 | 98 | type Operation interface{} | 98 | type Operation interface{} |
703 | 99 | 99 | ||
704 | 100 | type OpBootstrap struct { | 100 | type OpBootstrap struct { |
708 | 101 | Context environs.BootstrapContext | 101 | Context environs.BootstrapContext |
709 | 102 | Env string | 102 | Env string |
710 | 103 | Constraints constraints.Value | 103 | Args environs.BootstrapParams |
711 | 104 | } | 104 | } |
712 | 105 | 105 | ||
713 | 106 | type OpDestroy struct { | 106 | type OpDestroy struct { |
714 | @@ -562,8 +562,8 @@ | |||
715 | 562 | storage.NewStorageSimpleStreamsDataSource("cloud storage", e.Storage(), storage.BaseToolsPath)}, nil | 562 | storage.NewStorageSimpleStreamsDataSource("cloud storage", e.Storage(), storage.BaseToolsPath)}, nil |
716 | 563 | } | 563 | } |
717 | 564 | 564 | ||
720 | 565 | func (e *environ) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 565 | func (e *environ) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
721 | 566 | selectedTools, err := common.EnsureBootstrapTools(ctx, e, config.PreferredSeries(e.Config()), cons.Arch) | 566 | selectedTools, err := common.EnsureBootstrapTools(ctx, e, config.PreferredSeries(e.Config()), args.Constraints.Arch) |
722 | 567 | if err != nil { | 567 | if err != nil { |
723 | 568 | return err | 568 | return err |
724 | 569 | } | 569 | } |
725 | @@ -615,7 +615,7 @@ | |||
726 | 615 | if err != nil { | 615 | if err != nil { |
727 | 616 | panic(err) | 616 | panic(err) |
728 | 617 | } | 617 | } |
730 | 618 | if err := st.SetEnvironConstraints(cons); err != nil { | 618 | if err := st.SetEnvironConstraints(args.Constraints); err != nil { |
731 | 619 | panic(err) | 619 | panic(err) |
732 | 620 | } | 620 | } |
733 | 621 | if err := st.SetAdminMongoPassword(utils.UserPasswordHash(password, utils.CompatSalt)); err != nil { | 621 | if err := st.SetAdminMongoPassword(utils.UserPasswordHash(password, utils.CompatSalt)); err != nil { |
734 | @@ -632,7 +632,7 @@ | |||
735 | 632 | estate.apiState = st | 632 | estate.apiState = st |
736 | 633 | } | 633 | } |
737 | 634 | estate.bootstrapped = true | 634 | estate.bootstrapped = true |
739 | 635 | estate.ops <- OpBootstrap{Context: ctx, Env: e.name, Constraints: cons} | 635 | estate.ops <- OpBootstrap{Context: ctx, Env: e.name, Args: args} |
740 | 636 | return nil | 636 | return nil |
741 | 637 | } | 637 | } |
742 | 638 | 638 | ||
743 | 639 | 639 | ||
744 | === modified file 'provider/ec2/ec2.go' | |||
745 | --- provider/ec2/ec2.go 2014-04-22 09:23:39 +0000 | |||
746 | +++ provider/ec2/ec2.go 2014-04-24 03:34:13 +0000 | |||
747 | @@ -323,8 +323,8 @@ | |||
748 | 323 | return stor | 323 | return stor |
749 | 324 | } | 324 | } |
750 | 325 | 325 | ||
753 | 326 | func (e *environ) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 326 | func (e *environ) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
754 | 327 | return common.Bootstrap(ctx, e, cons) | 327 | return common.Bootstrap(ctx, e, args) |
755 | 328 | } | 328 | } |
756 | 329 | 329 | ||
757 | 330 | func (e *environ) StateInfo() (*state.Info, *api.Info, error) { | 330 | func (e *environ) StateInfo() (*state.Info, *api.Info, error) { |
758 | 331 | 331 | ||
759 | === modified file 'provider/ec2/local_test.go' | |||
760 | --- provider/ec2/local_test.go 2014-04-22 09:23:39 +0000 | |||
761 | +++ provider/ec2/local_test.go 2014-04-24 03:34:13 +0000 | |||
762 | @@ -218,7 +218,7 @@ | |||
763 | 218 | func (t *localServerSuite) TestBootstrapInstanceUserDataAndState(c *gc.C) { | 218 | func (t *localServerSuite) TestBootstrapInstanceUserDataAndState(c *gc.C) { |
764 | 219 | env := t.Prepare(c) | 219 | env := t.Prepare(c) |
765 | 220 | envtesting.UploadFakeTools(c, env.Storage()) | 220 | envtesting.UploadFakeTools(c, env.Storage()) |
767 | 221 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 221 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
768 | 222 | c.Assert(err, gc.IsNil) | 222 | c.Assert(err, gc.IsNil) |
769 | 223 | 223 | ||
770 | 224 | // check that the state holds the id of the bootstrap machine. | 224 | // check that the state holds the id of the bootstrap machine. |
771 | @@ -303,7 +303,7 @@ | |||
772 | 303 | func (t *localServerSuite) TestInstanceStatus(c *gc.C) { | 303 | func (t *localServerSuite) TestInstanceStatus(c *gc.C) { |
773 | 304 | env := t.Prepare(c) | 304 | env := t.Prepare(c) |
774 | 305 | envtesting.UploadFakeTools(c, env.Storage()) | 305 | envtesting.UploadFakeTools(c, env.Storage()) |
776 | 306 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 306 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
777 | 307 | c.Assert(err, gc.IsNil) | 307 | c.Assert(err, gc.IsNil) |
778 | 308 | t.srv.ec2srv.SetInitialInstanceState(ec2test.Terminated) | 308 | t.srv.ec2srv.SetInitialInstanceState(ec2test.Terminated) |
779 | 309 | inst, _ := testing.AssertStartInstance(c, env, "1") | 309 | inst, _ := testing.AssertStartInstance(c, env, "1") |
780 | @@ -314,7 +314,7 @@ | |||
781 | 314 | func (t *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) { | 314 | func (t *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) { |
782 | 315 | env := t.Prepare(c) | 315 | env := t.Prepare(c) |
783 | 316 | envtesting.UploadFakeTools(c, env.Storage()) | 316 | envtesting.UploadFakeTools(c, env.Storage()) |
785 | 317 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 317 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
786 | 318 | c.Assert(err, gc.IsNil) | 318 | c.Assert(err, gc.IsNil) |
787 | 319 | _, hc := testing.AssertStartInstance(c, env, "1") | 319 | _, hc := testing.AssertStartInstance(c, env, "1") |
788 | 320 | c.Check(*hc.Arch, gc.Equals, "amd64") | 320 | c.Check(*hc.Arch, gc.Equals, "amd64") |
789 | @@ -326,7 +326,7 @@ | |||
790 | 326 | func (t *localServerSuite) TestAddresses(c *gc.C) { | 326 | func (t *localServerSuite) TestAddresses(c *gc.C) { |
791 | 327 | env := t.Prepare(c) | 327 | env := t.Prepare(c) |
792 | 328 | envtesting.UploadFakeTools(c, env.Storage()) | 328 | envtesting.UploadFakeTools(c, env.Storage()) |
794 | 329 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 329 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
795 | 330 | c.Assert(err, gc.IsNil) | 330 | c.Assert(err, gc.IsNil) |
796 | 331 | inst, _ := testing.AssertStartInstance(c, env, "1") | 331 | inst, _ := testing.AssertStartInstance(c, env, "1") |
797 | 332 | c.Assert(err, gc.IsNil) | 332 | c.Assert(err, gc.IsNil) |
798 | 333 | 333 | ||
799 | === modified file 'provider/joyent/environ.go' | |||
800 | --- provider/joyent/environ.go 2014-04-22 09:38:55 +0000 | |||
801 | +++ provider/joyent/environ.go 2014-04-24 03:34:13 +0000 | |||
802 | @@ -154,8 +154,8 @@ | |||
803 | 154 | return environs.EmptyStorage | 154 | return environs.EmptyStorage |
804 | 155 | } | 155 | } |
805 | 156 | 156 | ||
808 | 157 | func (env *joyentEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 157 | func (env *joyentEnviron) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
809 | 158 | return common.Bootstrap(ctx, env, cons) | 158 | return common.Bootstrap(ctx, env, args) |
810 | 159 | } | 159 | } |
811 | 160 | 160 | ||
812 | 161 | func (env *joyentEnviron) StateInfo() (*state.Info, *api.Info, error) { | 161 | func (env *joyentEnviron) StateInfo() (*state.Info, *api.Info, error) { |
813 | 162 | 162 | ||
814 | === modified file 'provider/joyent/local_test.go' | |||
815 | --- provider/joyent/local_test.go 2014-04-18 13:49:33 +0000 | |||
816 | +++ provider/joyent/local_test.go 2014-04-24 03:34:13 +0000 | |||
817 | @@ -190,7 +190,7 @@ | |||
818 | 190 | func (s *localServerSuite) TestStartInstance(c *gc.C) { | 190 | func (s *localServerSuite) TestStartInstance(c *gc.C) { |
819 | 191 | env := s.Prepare(c) | 191 | env := s.Prepare(c) |
820 | 192 | envtesting.UploadFakeTools(c, env.Storage()) | 192 | envtesting.UploadFakeTools(c, env.Storage()) |
822 | 193 | err := bootstrap.Bootstrap(bootstrapContext(c), env, constraints.Value{}) | 193 | err := bootstrap.Bootstrap(bootstrapContext(c), env, environs.BootstrapParams{}) |
823 | 194 | c.Assert(err, gc.IsNil) | 194 | c.Assert(err, gc.IsNil) |
824 | 195 | inst, _ := testing.AssertStartInstance(c, env, "100") | 195 | inst, _ := testing.AssertStartInstance(c, env, "100") |
825 | 196 | err = env.StopInstances([]instance.Instance{inst}) | 196 | err = env.StopInstances([]instance.Instance{inst}) |
826 | @@ -200,7 +200,7 @@ | |||
827 | 200 | func (s *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) { | 200 | func (s *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) { |
828 | 201 | env := s.Prepare(c) | 201 | env := s.Prepare(c) |
829 | 202 | envtesting.UploadFakeTools(c, env.Storage()) | 202 | envtesting.UploadFakeTools(c, env.Storage()) |
831 | 203 | err := bootstrap.Bootstrap(bootstrapContext(c), env, constraints.Value{}) | 203 | err := bootstrap.Bootstrap(bootstrapContext(c), env, environs.BootstrapParams{}) |
832 | 204 | c.Assert(err, gc.IsNil) | 204 | c.Assert(err, gc.IsNil) |
833 | 205 | _, hc := testing.AssertStartInstanceWithConstraints(c, env, "100", constraints.MustParse("mem=1024")) | 205 | _, hc := testing.AssertStartInstanceWithConstraints(c, env, "100", constraints.MustParse("mem=1024")) |
834 | 206 | c.Check(*hc.Arch, gc.Equals, "amd64") | 206 | c.Check(*hc.Arch, gc.Equals, "amd64") |
835 | @@ -310,7 +310,7 @@ | |||
836 | 310 | func (s *localServerSuite) TestBootstrapInstanceUserDataAndState(c *gc.C) { | 310 | func (s *localServerSuite) TestBootstrapInstanceUserDataAndState(c *gc.C) { |
837 | 311 | env := s.Prepare(c) | 311 | env := s.Prepare(c) |
838 | 312 | envtesting.UploadFakeTools(c, env.Storage()) | 312 | envtesting.UploadFakeTools(c, env.Storage()) |
840 | 313 | err := bootstrap.Bootstrap(bootstrapContext(c), env, constraints.Value{}) | 313 | err := bootstrap.Bootstrap(bootstrapContext(c), env, environs.BootstrapParams{}) |
841 | 314 | c.Assert(err, gc.IsNil) | 314 | c.Assert(err, gc.IsNil) |
842 | 315 | 315 | ||
843 | 316 | // check that the state holds the id of the bootstrap machine. | 316 | // check that the state holds the id of the bootstrap machine. |
844 | 317 | 317 | ||
845 | === modified file 'provider/local/config_test.go' | |||
846 | --- provider/local/config_test.go 2014-03-25 02:18:04 +0000 | |||
847 | +++ provider/local/config_test.go 2014-04-24 03:34:13 +0000 | |||
848 | @@ -8,7 +8,7 @@ | |||
849 | 8 | 8 | ||
850 | 9 | gc "launchpad.net/gocheck" | 9 | gc "launchpad.net/gocheck" |
851 | 10 | 10 | ||
853 | 11 | "launchpad.net/juju-core/constraints" | 11 | "launchpad.net/juju-core/environs" |
854 | 12 | "launchpad.net/juju-core/environs/config" | 12 | "launchpad.net/juju-core/environs/config" |
855 | 13 | "launchpad.net/juju-core/juju/osenv" | 13 | "launchpad.net/juju-core/juju/osenv" |
856 | 14 | "launchpad.net/juju-core/provider" | 14 | "launchpad.net/juju-core/provider" |
857 | @@ -109,6 +109,6 @@ | |||
858 | 109 | s.PatchValue(local.CheckIfRoot, func() bool { return true }) | 109 | s.PatchValue(local.CheckIfRoot, func() bool { return true }) |
859 | 110 | env, err := local.Provider.Prepare(testing.Context(c), minimalConfig(c)) | 110 | env, err := local.Provider.Prepare(testing.Context(c), minimalConfig(c)) |
860 | 111 | c.Assert(err, gc.IsNil) | 111 | c.Assert(err, gc.IsNil) |
862 | 112 | err = env.Bootstrap(testing.Context(c), constraints.Value{}) | 112 | err = env.Bootstrap(testing.Context(c), environs.BootstrapParams{}) |
863 | 113 | c.Assert(err, gc.ErrorMatches, "bootstrapping a local environment must not be done as root") | 113 | c.Assert(err, gc.ErrorMatches, "bootstrapping a local environment must not be done as root") |
864 | 114 | } | 114 | } |
865 | 115 | 115 | ||
866 | === modified file 'provider/local/environ.go' | |||
867 | --- provider/local/environ.go 2014-04-22 09:23:39 +0000 | |||
868 | +++ provider/local/environ.go 2014-04-24 03:34:13 +0000 | |||
869 | @@ -111,7 +111,7 @@ | |||
870 | 111 | } | 111 | } |
871 | 112 | 112 | ||
872 | 113 | // Bootstrap is specified in the Environ interface. | 113 | // Bootstrap is specified in the Environ interface. |
874 | 114 | func (env *localEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 114 | func (env *localEnviron) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
875 | 115 | if err := ensureNotRoot(); err != nil { | 115 | if err := ensureNotRoot(); err != nil { |
876 | 116 | return err | 116 | return err |
877 | 117 | } | 117 | } |
878 | @@ -161,7 +161,7 @@ | |||
879 | 161 | agent.StorageDir: env.config.storageDir(), | 161 | agent.StorageDir: env.config.storageDir(), |
880 | 162 | agent.StorageAddr: env.config.storageAddr(), | 162 | agent.StorageAddr: env.config.storageAddr(), |
881 | 163 | } | 163 | } |
883 | 164 | if err := environs.FinishMachineConfig(mcfg, cfg, cons); err != nil { | 164 | if err := environs.FinishMachineConfig(mcfg, cfg, args.Constraints); err != nil { |
884 | 165 | return err | 165 | return err |
885 | 166 | } | 166 | } |
886 | 167 | // don't write proxy settings for local machine | 167 | // don't write proxy settings for local machine |
887 | 168 | 168 | ||
888 | === modified file 'provider/local/environ_test.go' | |||
889 | --- provider/local/environ_test.go 2014-04-21 23:10:05 +0000 | |||
890 | +++ provider/local/environ_test.go 2014-04-24 03:34:13 +0000 | |||
891 | @@ -169,7 +169,7 @@ | |||
892 | 169 | c.Assert(err, gc.IsNil) | 169 | c.Assert(err, gc.IsNil) |
893 | 170 | envtesting.UploadFakeTools(c, environ.Storage()) | 170 | envtesting.UploadFakeTools(c, environ.Storage()) |
894 | 171 | defer environ.Storage().RemoveAll() | 171 | defer environ.Storage().RemoveAll() |
896 | 172 | err = environ.Bootstrap(ctx, constraints.Value{}) | 172 | err = environ.Bootstrap(ctx, environs.BootstrapParams{}) |
897 | 173 | c.Assert(err, gc.IsNil) | 173 | c.Assert(err, gc.IsNil) |
898 | 174 | return environ | 174 | return environ |
899 | 175 | } | 175 | } |
900 | 176 | 176 | ||
901 | === modified file 'provider/maas/environ.go' | |||
902 | --- provider/maas/environ.go 2014-04-23 09:33:46 +0000 | |||
903 | +++ provider/maas/environ.go 2014-04-24 03:34:13 +0000 | |||
904 | @@ -90,8 +90,8 @@ | |||
905 | 90 | } | 90 | } |
906 | 91 | 91 | ||
907 | 92 | // Bootstrap is specified in the Environ interface. | 92 | // Bootstrap is specified in the Environ interface. |
910 | 93 | func (env *maasEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 93 | func (env *maasEnviron) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
911 | 94 | return common.Bootstrap(ctx, env, cons) | 94 | return common.Bootstrap(ctx, env, args) |
912 | 95 | } | 95 | } |
913 | 96 | 96 | ||
914 | 97 | // StateInfo is specified in the Environ interface. | 97 | // StateInfo is specified in the Environ interface. |
915 | 98 | 98 | ||
916 | === modified file 'provider/maas/environ_whitebox_test.go' | |||
917 | --- provider/maas/environ_whitebox_test.go 2014-04-23 09:33:46 +0000 | |||
918 | +++ provider/maas/environ_whitebox_test.go 2014-04-24 03:34:13 +0000 | |||
919 | @@ -199,7 +199,7 @@ | |||
920 | 199 | lshwXML, err := suite.generateHWTemplate(map[string]string{"aa:bb:cc:dd:ee:f0": "eth0"}) | 199 | lshwXML, err := suite.generateHWTemplate(map[string]string{"aa:bb:cc:dd:ee:f0": "eth0"}) |
921 | 200 | c.Assert(err, gc.IsNil) | 200 | c.Assert(err, gc.IsNil) |
922 | 201 | suite.testMAASObject.TestServer.AddNodeDetails("node0", lshwXML) | 201 | suite.testMAASObject.TestServer.AddNodeDetails("node0", lshwXML) |
924 | 202 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 202 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
925 | 203 | c.Assert(err, gc.IsNil) | 203 | c.Assert(err, gc.IsNil) |
926 | 204 | // The bootstrap node has been acquired and started. | 204 | // The bootstrap node has been acquired and started. |
927 | 205 | operations := suite.testMAASObject.TestServer.NodeOperations() | 205 | operations := suite.testMAASObject.TestServer.NodeOperations() |
928 | @@ -496,7 +496,7 @@ | |||
929 | 496 | lshwXML, err := suite.generateHWTemplate(map[string]string{"aa:bb:cc:dd:ee:f0": "eth0"}) | 496 | lshwXML, err := suite.generateHWTemplate(map[string]string{"aa:bb:cc:dd:ee:f0": "eth0"}) |
930 | 497 | c.Assert(err, gc.IsNil) | 497 | c.Assert(err, gc.IsNil) |
931 | 498 | suite.testMAASObject.TestServer.AddNodeDetails("thenode", lshwXML) | 498 | suite.testMAASObject.TestServer.AddNodeDetails("thenode", lshwXML) |
933 | 499 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 499 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
934 | 500 | c.Assert(err, gc.IsNil) | 500 | c.Assert(err, gc.IsNil) |
935 | 501 | } | 501 | } |
936 | 502 | 502 | ||
937 | @@ -512,7 +512,7 @@ | |||
938 | 512 | c.Assert(err, gc.IsNil) | 512 | c.Assert(err, gc.IsNil) |
939 | 513 | err = env.SetConfig(cfg) | 513 | err = env.SetConfig(cfg) |
940 | 514 | c.Assert(err, gc.IsNil) | 514 | c.Assert(err, gc.IsNil) |
942 | 515 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 515 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
943 | 516 | stripped := strings.Replace(err.Error(), "\n", "", -1) | 516 | stripped := strings.Replace(err.Error(), "\n", "", -1) |
944 | 517 | c.Check(stripped, | 517 | c.Check(stripped, |
945 | 518 | gc.Matches, | 518 | gc.Matches, |
946 | @@ -522,7 +522,7 @@ | |||
947 | 522 | func (suite *environSuite) TestBootstrapFailsIfNoNodes(c *gc.C) { | 522 | func (suite *environSuite) TestBootstrapFailsIfNoNodes(c *gc.C) { |
948 | 523 | suite.setupFakeTools(c) | 523 | suite.setupFakeTools(c) |
949 | 524 | env := suite.makeEnviron() | 524 | env := suite.makeEnviron() |
951 | 525 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 525 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
952 | 526 | // Since there are no nodes, the attempt to allocate one returns a | 526 | // Since there are no nodes, the attempt to allocate one returns a |
953 | 527 | // 409: Conflict. | 527 | // 409: Conflict. |
954 | 528 | c.Check(err, gc.ErrorMatches, ".*409.*") | 528 | c.Check(err, gc.ErrorMatches, ".*409.*") |
955 | 529 | 529 | ||
956 | === modified file 'provider/manual/environ.go' | |||
957 | --- provider/manual/environ.go 2014-04-22 09:23:39 +0000 | |||
958 | +++ provider/manual/environ.go 2014-04-24 03:34:13 +0000 | |||
959 | @@ -102,7 +102,7 @@ | |||
960 | 102 | return false | 102 | return false |
961 | 103 | } | 103 | } |
962 | 104 | 104 | ||
964 | 105 | func (e *manualEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 105 | func (e *manualEnviron) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
965 | 106 | // Set "use-sshstorage" to false, so agents know not to use sshstorage. | 106 | // Set "use-sshstorage" to false, so agents know not to use sshstorage. |
966 | 107 | cfg, err := e.Config().Apply(map[string]interface{}{"use-sshstorage": false}) | 107 | cfg, err := e.Config().Apply(map[string]interface{}{"use-sshstorage": false}) |
967 | 108 | if err != nil { | 108 | if err != nil { |
968 | @@ -112,6 +112,7 @@ | |||
969 | 112 | return err | 112 | return err |
970 | 113 | } | 113 | } |
971 | 114 | envConfig := e.envConfig() | 114 | envConfig := e.envConfig() |
972 | 115 | // TODO(axw) consider how we can use placement to override bootstrap-host. | ||
973 | 115 | host := envConfig.bootstrapHost() | 116 | host := envConfig.bootstrapHost() |
974 | 116 | hc, series, err := manual.DetectSeriesAndHardwareCharacteristics(host) | 117 | hc, series, err := manual.DetectSeriesAndHardwareCharacteristics(host) |
975 | 117 | if err != nil { | 118 | if err != nil { |
976 | 118 | 119 | ||
977 | === modified file 'provider/openstack/live_test.go' | |||
978 | --- provider/openstack/live_test.go 2014-02-18 02:53:44 +0000 | |||
979 | +++ provider/openstack/live_test.go 2014-04-24 03:34:13 +0000 | |||
980 | @@ -14,7 +14,6 @@ | |||
981 | 14 | "launchpad.net/goose/identity" | 14 | "launchpad.net/goose/identity" |
982 | 15 | "launchpad.net/goose/nova" | 15 | "launchpad.net/goose/nova" |
983 | 16 | 16 | ||
984 | 17 | "launchpad.net/juju-core/constraints" | ||
985 | 18 | "launchpad.net/juju-core/environs" | 17 | "launchpad.net/juju-core/environs" |
986 | 19 | "launchpad.net/juju-core/environs/bootstrap" | 18 | "launchpad.net/juju-core/environs/bootstrap" |
987 | 20 | "launchpad.net/juju-core/environs/config" | 19 | "launchpad.net/juju-core/environs/config" |
988 | @@ -230,7 +229,7 @@ | |||
989 | 230 | c.Assert(env, gc.NotNil) | 229 | c.Assert(env, gc.NotNil) |
990 | 231 | defer env.Destroy() | 230 | defer env.Destroy() |
991 | 232 | // Bootstrap and start an instance. | 231 | // Bootstrap and start an instance. |
993 | 233 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 232 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
994 | 234 | c.Assert(err, gc.IsNil) | 233 | c.Assert(err, gc.IsNil) |
995 | 235 | inst, _ := jujutesting.AssertStartInstance(c, env, "100") | 234 | inst, _ := jujutesting.AssertStartInstance(c, env, "100") |
996 | 236 | // Check whether the instance has the default security group assigned. | 235 | // Check whether the instance has the default security group assigned. |
997 | 237 | 236 | ||
998 | === modified file 'provider/openstack/local_test.go' | |||
999 | --- provider/openstack/local_test.go 2014-04-22 10:04:16 +0000 | |||
1000 | +++ provider/openstack/local_test.go 2014-04-24 03:34:13 +0000 | |||
1001 | @@ -232,7 +232,7 @@ | |||
1002 | 232 | c.Assert(err, gc.IsNil) | 232 | c.Assert(err, gc.IsNil) |
1003 | 233 | env, err := environs.New(cfg) | 233 | env, err := environs.New(cfg) |
1004 | 234 | c.Assert(err, gc.IsNil) | 234 | c.Assert(err, gc.IsNil) |
1006 | 235 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 235 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
1007 | 236 | c.Assert(err, gc.ErrorMatches, "(.|\n)*cannot allocate a public IP as needed(.|\n)*") | 236 | c.Assert(err, gc.ErrorMatches, "(.|\n)*cannot allocate a public IP as needed(.|\n)*") |
1008 | 237 | } | 237 | } |
1009 | 238 | 238 | ||
1010 | @@ -261,7 +261,7 @@ | |||
1011 | 261 | c.Assert(err, gc.IsNil) | 261 | c.Assert(err, gc.IsNil) |
1012 | 262 | env, err := environs.Prepare(cfg, coretesting.Context(c), s.ConfigStore) | 262 | env, err := environs.Prepare(cfg, coretesting.Context(c), s.ConfigStore) |
1013 | 263 | c.Assert(err, gc.IsNil) | 263 | c.Assert(err, gc.IsNil) |
1015 | 264 | err = bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 264 | err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
1016 | 265 | c.Assert(err, gc.IsNil) | 265 | c.Assert(err, gc.IsNil) |
1017 | 266 | inst, _ := testing.AssertStartInstance(c, env, "100") | 266 | inst, _ := testing.AssertStartInstance(c, env, "100") |
1018 | 267 | err = env.StopInstances([]instance.Instance{inst}) | 267 | err = env.StopInstances([]instance.Instance{inst}) |
1019 | @@ -270,7 +270,7 @@ | |||
1020 | 270 | 270 | ||
1021 | 271 | func (s *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) { | 271 | func (s *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) { |
1022 | 272 | env := s.Prepare(c) | 272 | env := s.Prepare(c) |
1024 | 273 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 273 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
1025 | 274 | c.Assert(err, gc.IsNil) | 274 | c.Assert(err, gc.IsNil) |
1026 | 275 | _, hc := testing.AssertStartInstanceWithConstraints(c, env, "100", constraints.MustParse("mem=1024")) | 275 | _, hc := testing.AssertStartInstanceWithConstraints(c, env, "100", constraints.MustParse("mem=1024")) |
1027 | 276 | c.Check(*hc.Arch, gc.Equals, "amd64") | 276 | c.Check(*hc.Arch, gc.Equals, "amd64") |
1028 | @@ -574,7 +574,7 @@ | |||
1029 | 574 | // It should be moved to environs.jujutests.Tests. | 574 | // It should be moved to environs.jujutests.Tests. |
1030 | 575 | func (s *localServerSuite) TestBootstrapInstanceUserDataAndState(c *gc.C) { | 575 | func (s *localServerSuite) TestBootstrapInstanceUserDataAndState(c *gc.C) { |
1031 | 576 | env := s.Prepare(c) | 576 | env := s.Prepare(c) |
1033 | 577 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 577 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
1034 | 578 | c.Assert(err, gc.IsNil) | 578 | c.Assert(err, gc.IsNil) |
1035 | 579 | 579 | ||
1036 | 580 | // check that the state holds the id of the bootstrap machine. | 580 | // check that the state holds the id of the bootstrap machine. |
1037 | @@ -933,7 +933,7 @@ | |||
1038 | 933 | openstack.UseTestImageData(metadataStorage, s.cred) | 933 | openstack.UseTestImageData(metadataStorage, s.cred) |
1039 | 934 | defer openstack.RemoveTestImageData(metadataStorage) | 934 | defer openstack.RemoveTestImageData(metadataStorage) |
1040 | 935 | 935 | ||
1042 | 936 | err = bootstrap.Bootstrap(coretesting.Context(c), s.env, constraints.Value{}) | 936 | err = bootstrap.Bootstrap(coretesting.Context(c), s.env, environs.BootstrapParams{}) |
1043 | 937 | c.Assert(err, gc.IsNil) | 937 | c.Assert(err, gc.IsNil) |
1044 | 938 | } | 938 | } |
1045 | 939 | 939 | ||
1046 | @@ -1076,7 +1076,7 @@ | |||
1047 | 1076 | 1076 | ||
1048 | 1077 | func (s *localServerSuite) TestAllInstancesIgnoresOtherMachines(c *gc.C) { | 1077 | func (s *localServerSuite) TestAllInstancesIgnoresOtherMachines(c *gc.C) { |
1049 | 1078 | env := s.Prepare(c) | 1078 | env := s.Prepare(c) |
1051 | 1079 | err := bootstrap.Bootstrap(coretesting.Context(c), env, constraints.Value{}) | 1079 | err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{}) |
1052 | 1080 | c.Assert(err, gc.IsNil) | 1080 | c.Assert(err, gc.IsNil) |
1053 | 1081 | 1081 | ||
1054 | 1082 | // Check that we see 1 instance in the environment | 1082 | // Check that we see 1 instance in the environment |
1055 | 1083 | 1083 | ||
1056 | === modified file 'provider/openstack/provider.go' | |||
1057 | --- provider/openstack/provider.go 2014-04-22 09:23:39 +0000 | |||
1058 | +++ provider/openstack/provider.go 2014-04-24 03:34:13 +0000 | |||
1059 | @@ -566,7 +566,7 @@ | |||
1060 | 566 | return stor | 566 | return stor |
1061 | 567 | } | 567 | } |
1062 | 568 | 568 | ||
1064 | 569 | func (e *environ) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error { | 569 | func (e *environ) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) error { |
1065 | 570 | // The client's authentication may have been reset when finding tools if the agent-version | 570 | // The client's authentication may have been reset when finding tools if the agent-version |
1066 | 571 | // attribute was updated so we need to re-authenticate. This will be a no-op if already authenticated. | 571 | // attribute was updated so we need to re-authenticate. This will be a no-op if already authenticated. |
1067 | 572 | // An authenticated client is needed for the URL() call below. | 572 | // An authenticated client is needed for the URL() call below. |
1068 | @@ -574,7 +574,7 @@ | |||
1069 | 574 | if err != nil { | 574 | if err != nil { |
1070 | 575 | return err | 575 | return err |
1071 | 576 | } | 576 | } |
1073 | 577 | return common.Bootstrap(ctx, e, cons) | 577 | return common.Bootstrap(ctx, e, args) |
1074 | 578 | } | 578 | } |
1075 | 579 | 579 | ||
1076 | 580 | func (e *environ) StateInfo() (*state.Info, *api.Info, error) { | 580 | func (e *environ) StateInfo() (*state.Info, *api.Info, error) { |
Reviewers: mp+216971_ code.launchpad. net,
Message:
Please take a look.
Description:
Support placement directives on bootstrap
juju bootstrap will accept a single, optional
positional argument that will be parsed as a
placement directive. We currently only allow
unscoped placement directives at bootstrap.
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1237709- bootstrap- placement/ +merge/ 216971
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/91740043/
Affected files (+156, -108 lines): bootstrap. go bootstrap_ test.go cmd_test. go deploy_ test.go juju-restore/ restore. go bootstrap/ bootstrap. go bootstrap/ bootstrap_ test.go interface. go jujutest/ livetests. go jujutest/ tests.go open_test. go test.go conn.go azure/environ. go common/ bootstrap. go common/ bootstrap_ test.go common/ mock_test. go dummy/environs. go ec2/local_ test.go joyent/ environ. go joyent/ local_test. go local/config_ test.go local/environ. go local/environ_ test.go maas/environ. go maas/environ_ whitebox_ test.go manual/ environ. go openstack/ live_test. go openstack/ local_test. go openstack/ provider. go
A [revision details]
M cmd/juju/
M cmd/juju/
M cmd/juju/
M cmd/juju/
M cmd/plugins/
M environs/
M environs/
M environs/
M environs/
M environs/
M environs/
M juju/apiconn_
M juju/conn_test.go
M juju/testing/
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/ec2/ec2.go
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/
M provider/