Merge lp:~axwalk/juju-core/lp1272614-rename-null-manual into lp:~go-bot/juju-core/trunk

Proposed by Andrew Wilkins
Status: Merged
Approved by: Andrew Wilkins
Approved revision: no longer in the source branch.
Merged at revision: 2285
Proposed branch: lp:~axwalk/juju-core/lp1272614-rename-null-manual
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 766 lines (+147/-110)
17 files modified
cmd/jujud/machine.go (+1/-1)
environs/config.go (+7/-0)
environs/config/config.go (+4/-0)
environs/config/config_test.go (+12/-0)
environs/config_test.go (+7/-0)
provider/all/all.go (+1/-1)
provider/manual/config.go (+1/-1)
provider/manual/config_test.go (+8/-9)
provider/manual/environ.go (+52/-52)
provider/manual/environ_test.go (+3/-3)
provider/manual/export_test.go (+2/-2)
provider/manual/instance.go (+17/-17)
provider/manual/provider.go (+17/-16)
provider/manual/provider_test.go (+4/-4)
provider/manual/suite_test.go (+1/-1)
provider/provider.go (+6/-1)
state/machine.go (+4/-2)
To merge this branch: bzr merge lp:~axwalk/juju-core/lp1272614-rename-null-manual
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+203682@code.launchpad.net

Commit message

Rename null to manual

The null provider is renamed to manual. We retain
an alias of "null", for existing deployments.

Fixes #1272614

https://codereview.appspot.com/53040046/

Description of the change

Rename null to manual

The null provider is renamed to manual. We retain
an alias of "null", for existing deployments.

Fixes #1272614

https://codereview.appspot.com/53040046/

To post a comment you must log in.
Revision history for this message
Andrew Wilkins (axwalk) wrote :

Reviewers: mp+203682_code.launchpad.net,

Message:
Please take a look.

Description:
Rename null to manual

The null provider is renamed to manual. We retain
an alias of "null", for existing deployments.

Fixes #1272614

https://code.launchpad.net/~axwalk/juju-core/lp1272614-rename-null-manual/+merge/203682

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/53040046/

Affected files (+113, -102 lines):
   A [revision details]
   M cmd/jujud/machine.go
   M cmd/jujud/machine_test.go
   M provider/all/all.go
   M provider/manual/config.go
   M provider/manual/config_test.go
   M provider/manual/environ.go
   M provider/manual/environ_test.go
   M provider/manual/instance.go
   M provider/manual/provider.go
   M provider/manual/suite_test.go
   M provider/provider.go
   M state/machine.go

Revision history for this message
William Reade (fwereade) wrote :

On 2014/01/29 09:23:06, axw wrote:
> Please take a look.

sorry, going to bed so not reviewing properly, but please communicate
the changes to evilnick so we can get the docs updated in a fashion
indicating joined-up thinking.

https://codereview.appspot.com/53040046/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2014/01/29 22:38:53, fwereade wrote:
> On 2014/01/29 09:23:06, axw wrote:
> > Please take a look.

> sorry, going to bed so not reviewing properly, but please communicate
the
> changes to evilnick so we can get the docs updated in a fashion
indicating
> joined-up thinking.

Absolutely. In fact, all these changes to the manual provider are a
precursor to updating the docs :)

https://codereview.appspot.com/53040046/

Revision history for this message
Nick Veitch (evilnick) wrote :

My spider sense is tingling
On Jan 30, 2014 1:12 AM, "Andrew Wilkins" <email address hidden>
wrote:

> On 2014/01/29 22:38:53, fwereade wrote:
> > On 2014/01/29 09:23:06, axw wrote:
> > > Please take a look.
>
> > sorry, going to bed so not reviewing properly, but please communicate
> the
> > changes to evilnick so we can get the docs updated in a fashion
> indicating
> > joined-up thinking.
>
> Absolutely. In fact, all these changes to the manual provider are a
> precursor to updating the docs :)
>
> https://codereview.appspot.com/53040046/
>
> --
>
> https://code.launchpad.net/~axwalk/juju-core/lp1272614-rename-null-manual/+merge/203682
> Your team juju hackers is requested to review the proposed merge of
> lp:~axwalk/juju-core/lp1272614-rename-null-manual into lp:juju-core.
>

Revision history for this message
Ian Booth (wallyworld) wrote :

I'd like to see a deprecation warning when people use a "null" provider
ie similar to how deprecation warnings are output for other old config
items

https://codereview.appspot.com/53040046/diff/1/provider/provider.go
File provider/provider.go (right):

https://codereview.appspot.com/53040046/diff/1/provider/provider.go#newcode12
provider/provider.go:12: Null = "null"
Do we still need this const?

https://codereview.appspot.com/53040046/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

Please take a look.

https://codereview.appspot.com/53040046/diff/1/provider/provider.go
File provider/provider.go (right):

https://codereview.appspot.com/53040046/diff/1/provider/provider.go#newcode12
provider/provider.go:12: Null = "null"
On 2014/01/31 01:55:01, wallyworld wrote:
> Do we still need this const?

There was one test that referred to it. Fixed and removed the constant.

https://codereview.appspot.com/53040046/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2014/01/31 01:55:01, wallyworld wrote:
> I'd like to see a deprecation warning when people use a "null"
provider ie
> similar to how deprecation warnings are output for other old config
items

I added a warning, and also updated environs/config to replace null with
manual.

> https://codereview.appspot.com/53040046/diff/1/provider/provider.go
> File provider/provider.go (right):

https://codereview.appspot.com/53040046/diff/1/provider/provider.go#newcode12
> provider/provider.go:12: Null = "null"
> Do we still need this const?

https://codereview.appspot.com/53040046/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

> My spider sense is tingling

I created a bug for updating the docs lp:1273927
I'll look over them today to see what needs doing.

> On Jan 30, 2014 1:12 AM, "Andrew Wilkins" <email address hidden>
> wrote:
>
> > On 2014/01/29 22:38:53, fwereade wrote:
> > > On 2014/01/29 09:23:06, axw wrote:
> > > > Please take a look.
> >
> > > sorry, going to bed so not reviewing properly, but please communicate
> > the
> > > changes to evilnick so we can get the docs updated in a fashion
> > indicating
> > > joined-up thinking.
> >
> > Absolutely. In fact, all these changes to the manual provider are a
> > precursor to updating the docs :)
> >
> > https://codereview.appspot.com/53040046/
> >
> > --
> >
> > https://code.launchpad.net/~axwalk/juju-core/lp1272614-rename-null-
> manual/+merge/203682
> > Your team juju hackers is requested to review the proposed merge of
> > lp:~axwalk/juju-core/lp1272614-rename-null-manual into lp:juju-core.
> >

Revision history for this message
Ian Booth (wallyworld) wrote :

LGTM. Thanks for the deprecation warnings etc.

https://codereview.appspot.com/53040046/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/jujud/machine.go'
2--- cmd/jujud/machine.go 2014-01-29 04:00:15 +0000
3+++ cmd/jujud/machine.go 2014-01-31 05:40:27 +0000
4@@ -295,7 +295,7 @@
5 // Take advantage of special knowledge here in that we will only ever want
6 // the storage provider on one machine, and that is the "bootstrap" node.
7 providerType := agentConfig.Value(agent.ProviderType)
8- if (providerType == provider.Local || providerType == provider.Null) && m.Id() == bootstrapMachineId {
9+ if (providerType == provider.Local || provider.IsManual(providerType)) && m.Id() == bootstrapMachineId {
10 runner.StartWorker("local-storage", func() (worker.Worker, error) {
11 // TODO(axw) 2013-09-24 bug #1229507
12 // Make another job to enable storage.
13
14=== modified file 'environs/config.go'
15--- environs/config.go 2014-01-28 04:58:43 +0000
16+++ environs/config.go 2014-01-31 05:40:27 +0000
17@@ -90,6 +90,13 @@
18 }
19 logger.Warningf(msg)
20 }
21+ // null has been renamed to manual (with an alias for existing config).
22+ if oldType, _ := attrs["type"].(string); oldType == "null" {
23+ logger.Warningf(
24+ "Provider type \"null\" has been renamed to \"manual\".\n" +
25+ "Please update your environment configuration.",
26+ )
27+ }
28
29 cfg, err := config.New(config.UseDefaults, attrs)
30 if err != nil {
31
32=== modified file 'environs/config/config.go'
33--- environs/config/config.go 2014-01-30 14:13:54 +0000
34+++ environs/config/config.go 2014-01-31 05:40:27 +0000
35@@ -215,6 +215,10 @@
36 // Even if the user has edited their environment yaml to remove the deprecated tools-url value,
37 // we still want it in the config for upgrades.
38 cfg.m["tools-url"], _ = cfg.ToolsURL()
39+ // Update the provider type from null to manual.
40+ if cfg.Type() == "null" {
41+ cfg.m["type"] = "manual"
42+ }
43 }
44
45 // Validate ensures that config is a valid configuration. If old is not nil,
46
47=== modified file 'environs/config/config_test.go'
48--- environs/config/config_test.go 2014-01-30 14:13:54 +0000
49+++ environs/config/config_test.go 2014-01-31 05:40:27 +0000
50@@ -622,6 +622,13 @@
51 "firewall-mode": "instance",
52 "type": "ec2",
53 },
54+ }, {
55+ about: "Provider type null is replaced with manual",
56+ useDefaults: config.UseDefaults,
57+ attrs: testing.Attrs{
58+ "type": "null",
59+ "name": "my-name",
60+ },
61 },
62 authTokenConfigTest("token=value, tokensecret=value", true),
63 authTokenConfigTest("token=value, ", true),
64@@ -813,6 +820,11 @@
65 c.Assert(err, gc.IsNil)
66
67 typ, _ := test.attrs["type"].(string)
68+ // "null" has been deprecated in favour of "manual",
69+ // and is automatically switched.
70+ if typ == "null" {
71+ typ = "manual"
72+ }
73 name, _ := test.attrs["name"].(string)
74 c.Assert(cfg.Type(), gc.Equals, typ)
75 c.Assert(cfg.Name(), gc.Equals, name)
76
77=== modified file 'environs/config_test.go'
78--- environs/config_test.go 2014-01-28 04:58:43 +0000
79+++ environs/config_test.go 2014-01-31 05:40:27 +0000
80@@ -16,6 +16,7 @@
81 "launchpad.net/juju-core/environs"
82 "launchpad.net/juju-core/environs/config"
83 "launchpad.net/juju-core/provider/dummy"
84+ _ "launchpad.net/juju-core/provider/manual"
85 "launchpad.net/juju-core/testing"
86 jc "launchpad.net/juju-core/testing/checkers"
87 "launchpad.net/juju-core/testing/testbase"
88@@ -361,3 +362,9 @@
89 `the new tools URL attribute "tools-metadata-url".*`)
90 s.checkDeprecationWarning(c, attrs, expected)
91 }
92+
93+func (s *ConfigDeprecationSuite) TestDeprecatedTypeNullWarning(c *gc.C) {
94+ attrs := testing.Attrs{"type": "null"}
95+ expected := `Provider type \"null\" has been renamed to \"manual\"\.Please update your environment configuration\.`
96+ s.checkDeprecationWarning(c, attrs, expected)
97+}
98
99=== modified file 'provider/all/all.go'
100--- provider/all/all.go 2013-10-07 10:57:04 +0000
101+++ provider/all/all.go 2014-01-31 05:40:27 +0000
102@@ -9,7 +9,7 @@
103 _ "launchpad.net/juju-core/provider/ec2"
104 _ "launchpad.net/juju-core/provider/local"
105 _ "launchpad.net/juju-core/provider/maas"
106- _ "launchpad.net/juju-core/provider/null"
107+ _ "launchpad.net/juju-core/provider/manual"
108 _ "launchpad.net/juju-core/provider/openstack"
109 //_ "launchpad.net/juju-core/provider/joyent"
110 )
111
112=== renamed directory 'provider/null' => 'provider/manual'
113=== modified file 'provider/manual/config.go'
114--- provider/null/config.go 2013-12-23 06:06:40 +0000
115+++ provider/manual/config.go 2014-01-31 05:40:27 +0000
116@@ -1,7 +1,7 @@
117 // Copyright 2013 Canonical Ltd.
118 // Licensed under the AGPLv3, see LICENCE file for details.
119
120-package null
121+package manual
122
123 import (
124 "fmt"
125
126=== modified file 'provider/manual/config_test.go'
127--- provider/null/config_test.go 2014-01-29 10:08:01 +0000
128+++ provider/manual/config_test.go 2014-01-31 05:40:27 +0000
129@@ -1,7 +1,7 @@
130 // Copyright 2013 Canonical Ltd.
131 // Licensed under the AGPLv3, see LICENCE file for details.
132
133-package null
134+package manual
135
136 import (
137 "fmt"
138@@ -10,7 +10,6 @@
139 gc "launchpad.net/gocheck"
140
141 "launchpad.net/juju-core/environs/config"
142- "launchpad.net/juju-core/provider"
143 coretesting "launchpad.net/juju-core/testing"
144 "launchpad.net/juju-core/testing/testbase"
145 )
146@@ -24,7 +23,7 @@
147 func MinimalConfigValues() map[string]interface{} {
148 return map[string]interface{}{
149 "name": "test",
150- "type": provider.Null,
151+ "type": "manual",
152 "bootstrap-host": "hostname",
153 "storage-auth-key": "whatever",
154 // While the ca-cert bits aren't entirely minimal, they avoid the need
155@@ -44,7 +43,7 @@
156 func getEnvironConfig(c *gc.C, attrs map[string]interface{}) *environConfig {
157 testConfig, err := config.New(config.UseDefaults, attrs)
158 c.Assert(err, gc.IsNil)
159- envConfig, err := nullProvider{}.validate(testConfig, nil)
160+ envConfig, err := manualProvider{}.validate(testConfig, nil)
161 c.Assert(err, gc.IsNil)
162 return envConfig
163 }
164@@ -53,16 +52,16 @@
165 testConfig := MinimalConfig(c)
166 testConfig, err := testConfig.Apply(map[string]interface{}{"bootstrap-host": ""})
167 c.Assert(err, gc.IsNil)
168- _, err = nullProvider{}.Validate(testConfig, nil)
169+ _, err = manualProvider{}.Validate(testConfig, nil)
170 c.Assert(err, gc.ErrorMatches, "bootstrap-host must be specified")
171
172 testConfig, err = testConfig.Apply(map[string]interface{}{"storage-auth-key": nil})
173 c.Assert(err, gc.IsNil)
174- _, err = nullProvider{}.Validate(testConfig, nil)
175+ _, err = manualProvider{}.Validate(testConfig, nil)
176 c.Assert(err, gc.ErrorMatches, "storage-auth-key: expected string, got nothing")
177
178 testConfig = MinimalConfig(c)
179- valid, err := nullProvider{}.Validate(testConfig, nil)
180+ valid, err := manualProvider{}.Validate(testConfig, nil)
181 c.Assert(err, gc.IsNil)
182
183 unknownAttrs := valid.UnknownAttrs()
184@@ -74,7 +73,7 @@
185
186 func (s *configSuite) TestConfigMutability(c *gc.C) {
187 testConfig := MinimalConfig(c)
188- valid, err := nullProvider{}.Validate(testConfig, nil)
189+ valid, err := manualProvider{}.Validate(testConfig, nil)
190 c.Assert(err, gc.IsNil)
191 unknownAttrs := valid.UnknownAttrs()
192
193@@ -91,7 +90,7 @@
194 testConfig = MinimalConfig(c)
195 testConfig, err = testConfig.Apply(map[string]interface{}{k: v})
196 c.Assert(err, gc.IsNil)
197- _, err := nullProvider{}.Validate(testConfig, oldConfig)
198+ _, err := manualProvider{}.Validate(testConfig, oldConfig)
199 oldv := unknownAttrs[k]
200 errmsg := fmt.Sprintf("cannot change %s from %q to %q", k, oldv, v)
201 c.Assert(err, gc.ErrorMatches, regexp.QuoteMeta(errmsg))
202
203=== modified file 'provider/manual/environ.go'
204--- provider/null/environ.go 2014-01-28 04:58:43 +0000
205+++ provider/manual/environ.go 2014-01-31 05:40:27 +0000
206@@ -1,7 +1,7 @@
207 // Copyright 2013 Canonical Ltd.
208 // Licensed under the AGPLv3, see LICENCE file for details.
209
210-package null
211+package manual
212
213 import (
214 "bytes"
215@@ -48,9 +48,9 @@
216 storageTmpSubdir = "storage-tmp"
217 )
218
219-var logger = loggo.GetLogger("juju.provider.null")
220+var logger = loggo.GetLogger("juju.provider.manual")
221
222-type nullEnviron struct {
223+type manualEnviron struct {
224 cfg *environConfig
225 cfgmutex sync.Mutex
226 bootstrapStorage storage.Storage
227@@ -59,42 +59,42 @@
228 ubuntuUserInitMutex sync.Mutex
229 }
230
231-var _ environs.BootstrapStorager = (*nullEnviron)(nil)
232-var _ envtools.SupportsCustomSources = (*nullEnviron)(nil)
233-
234-var errNoStartInstance = errors.New("null provider cannot start instances")
235-var errNoStopInstance = errors.New("null provider cannot stop instances")
236-
237-func (*nullEnviron) StartInstance(constraints.Value, tools.List, *cloudinit.MachineConfig) (instance.Instance, *instance.HardwareCharacteristics, error) {
238+var _ environs.BootstrapStorager = (*manualEnviron)(nil)
239+var _ envtools.SupportsCustomSources = (*manualEnviron)(nil)
240+
241+var errNoStartInstance = errors.New("manual provider cannot start instances")
242+var errNoStopInstance = errors.New("manual provider cannot stop instances")
243+
244+func (*manualEnviron) StartInstance(constraints.Value, tools.List, *cloudinit.MachineConfig) (instance.Instance, *instance.HardwareCharacteristics, error) {
245 return nil, nil, errNoStartInstance
246 }
247
248-func (*nullEnviron) StopInstances([]instance.Instance) error {
249+func (*manualEnviron) StopInstances([]instance.Instance) error {
250 return errNoStopInstance
251 }
252
253-func (e *nullEnviron) AllInstances() ([]instance.Instance, error) {
254+func (e *manualEnviron) AllInstances() ([]instance.Instance, error) {
255 return e.Instances([]instance.Id{manual.BootstrapInstanceId})
256 }
257
258-func (e *nullEnviron) envConfig() (cfg *environConfig) {
259+func (e *manualEnviron) envConfig() (cfg *environConfig) {
260 e.cfgmutex.Lock()
261 cfg = e.cfg
262 e.cfgmutex.Unlock()
263 return cfg
264 }
265
266-func (e *nullEnviron) Config() *config.Config {
267+func (e *manualEnviron) Config() *config.Config {
268 return e.envConfig().Config
269 }
270
271-func (e *nullEnviron) Name() string {
272+func (e *manualEnviron) Name() string {
273 return e.envConfig().Name()
274 }
275
276 var initUbuntuUser = manual.InitUbuntuUser
277
278-func (e *nullEnviron) ensureBootstrapUbuntuUser(ctx environs.BootstrapContext) error {
279+func (e *manualEnviron) ensureBootstrapUbuntuUser(ctx environs.BootstrapContext) error {
280 e.ubuntuUserInitMutex.Lock()
281 defer e.ubuntuUserInitMutex.Unlock()
282 if e.ubuntuUserInited {
283@@ -111,7 +111,7 @@
284 return nil
285 }
286
287-func (e *nullEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error {
288+func (e *manualEnviron) Bootstrap(ctx environs.BootstrapContext, cons constraints.Value) error {
289 if err := e.ensureBootstrapUbuntuUser(ctx); err != nil {
290 return err
291 }
292@@ -136,14 +136,14 @@
293 })
294 }
295
296-func (e *nullEnviron) StateInfo() (*state.Info, *api.Info, error) {
297+func (e *manualEnviron) StateInfo() (*state.Info, *api.Info, error) {
298 return common.StateInfo(e)
299 }
300
301-func (e *nullEnviron) SetConfig(cfg *config.Config) error {
302+func (e *manualEnviron) SetConfig(cfg *config.Config) error {
303 e.cfgmutex.Lock()
304 defer e.cfgmutex.Unlock()
305- envConfig, err := nullProvider{}.validate(cfg, e.cfg.Config)
306+ envConfig, err := manualProvider{}.validate(cfg, e.cfg.Config)
307 if err != nil {
308 return err
309 }
310@@ -157,12 +157,12 @@
311 // environ/manual.BootstrapInstanceId. If any others are
312 // specified, then ErrPartialInstances or ErrNoInstances
313 // will result.
314-func (e *nullEnviron) Instances(ids []instance.Id) (instances []instance.Instance, err error) {
315+func (e *manualEnviron) Instances(ids []instance.Id) (instances []instance.Instance, err error) {
316 instances = make([]instance.Instance, len(ids))
317 var found bool
318 for i, id := range ids {
319 if id == manual.BootstrapInstanceId {
320- instances[i] = nullBootstrapInstance{e.envConfig().bootstrapHost()}
321+ instances[i] = manualBootstrapInstance{e.envConfig().bootstrapHost()}
322 found = true
323 } else {
324 err = environs.ErrPartialInstances
325@@ -183,7 +183,7 @@
326 }
327
328 // Implements environs.BootstrapStorager.
329-func (e *nullEnviron) EnableBootstrapStorage(ctx environs.BootstrapContext) error {
330+func (e *manualEnviron) EnableBootstrapStorage(ctx environs.BootstrapContext) error {
331 e.bootstrapStorageMutex.Lock()
332 defer e.bootstrapStorageMutex.Unlock()
333 if e.bootstrapStorage != nil {
334@@ -205,14 +205,14 @@
335
336 // GetToolsSources returns a list of sources which are
337 // used to search for simplestreams tools metadata.
338-func (e *nullEnviron) GetToolsSources() ([]simplestreams.DataSource, error) {
339+func (e *manualEnviron) GetToolsSources() ([]simplestreams.DataSource, error) {
340 // Add the simplestreams source off private storage.
341 return []simplestreams.DataSource{
342 storage.NewStorageSimpleStreamsDataSource(e.Storage(), storage.BaseToolsPath),
343 }, nil
344 }
345
346-func (e *nullEnviron) Storage() storage.Storage {
347+func (e *manualEnviron) Storage() storage.Storage {
348 e.bootstrapStorageMutex.Lock()
349 defer e.bootstrapStorageMutex.Unlock()
350 if e.bootstrapStorage != nil {
351@@ -241,7 +241,7 @@
352 return stderrBuf.String(), err
353 }
354
355-func (e *nullEnviron) Destroy() error {
356+func (e *manualEnviron) Destroy() error {
357 stderr, err := runSSHCommand(
358 "ubuntu@"+e.envConfig().bootstrapHost(),
359 []string{"sudo", "pkill", fmt.Sprintf("-%d", terminationworker.TerminationSignal), "jujud"},
360@@ -254,53 +254,53 @@
361 return err
362 }
363
364-func (e *nullEnviron) OpenPorts(ports []instance.Port) error {
365- return nil
366-}
367-
368-func (e *nullEnviron) ClosePorts(ports []instance.Port) error {
369- return nil
370-}
371-
372-func (e *nullEnviron) Ports() ([]instance.Port, error) {
373+func (e *manualEnviron) OpenPorts(ports []instance.Port) error {
374+ return nil
375+}
376+
377+func (e *manualEnviron) ClosePorts(ports []instance.Port) error {
378+ return nil
379+}
380+
381+func (e *manualEnviron) Ports() ([]instance.Port, error) {
382 return []instance.Port{}, nil
383 }
384
385-func (*nullEnviron) Provider() environs.EnvironProvider {
386- return nullProvider{}
387+func (*manualEnviron) Provider() environs.EnvironProvider {
388+ return manualProvider{}
389 }
390
391-func (e *nullEnviron) StorageAddr() string {
392+func (e *manualEnviron) StorageAddr() string {
393 return e.envConfig().storageListenAddr()
394 }
395
396-func (e *nullEnviron) StorageDir() string {
397+func (e *manualEnviron) StorageDir() string {
398 return path.Join(dataDir, storageSubdir)
399 }
400
401-func (e *nullEnviron) SharedStorageAddr() string {
402- return ""
403-}
404-
405-func (e *nullEnviron) SharedStorageDir() string {
406- return ""
407-}
408-
409-func (e *nullEnviron) StorageCACert() []byte {
410+func (e *manualEnviron) SharedStorageAddr() string {
411+ return ""
412+}
413+
414+func (e *manualEnviron) SharedStorageDir() string {
415+ return ""
416+}
417+
418+func (e *manualEnviron) StorageCACert() []byte {
419 if bytes, ok := e.envConfig().CACert(); ok {
420 return bytes
421 }
422 return nil
423 }
424
425-func (e *nullEnviron) StorageCAKey() []byte {
426+func (e *manualEnviron) StorageCAKey() []byte {
427 if bytes, ok := e.envConfig().CAPrivateKey(); ok {
428 return bytes
429 }
430 return nil
431 }
432
433-func (e *nullEnviron) StorageHostnames() []string {
434+func (e *manualEnviron) StorageHostnames() []string {
435 cfg := e.envConfig()
436 hostnames := []string{cfg.bootstrapHost()}
437 if ip := net.ParseIP(cfg.storageListenIPAddress()); ip != nil {
438@@ -311,8 +311,8 @@
439 return hostnames
440 }
441
442-func (e *nullEnviron) StorageAuthKey() string {
443+func (e *manualEnviron) StorageAuthKey() string {
444 return e.envConfig().storageAuthKey()
445 }
446
447-var _ localstorage.LocalTLSStorageConfig = (*nullEnviron)(nil)
448+var _ localstorage.LocalTLSStorageConfig = (*manualEnviron)(nil)
449
450=== modified file 'provider/manual/environ_test.go'
451--- provider/null/environ_test.go 2014-01-29 10:08:01 +0000
452+++ provider/manual/environ_test.go 2014-01-31 05:40:27 +0000
453@@ -1,7 +1,7 @@
454 // Copyright 2012 Canonical Ltd.
455 // Licensed under the AGPLv3, see LICENCE file for details.
456
457-package null
458+package manual
459
460 import (
461 "errors"
462@@ -23,14 +23,14 @@
463
464 type environSuite struct {
465 testbase.LoggingSuite
466- env *nullEnviron
467+ env *manualEnviron
468 }
469
470 var _ = gc.Suite(&environSuite{})
471
472 func (s *environSuite) SetUpTest(c *gc.C) {
473 envConfig := getEnvironConfig(c, MinimalConfigValues())
474- s.env = &nullEnviron{cfg: envConfig}
475+ s.env = &manualEnviron{cfg: envConfig}
476 }
477
478 func (s *environSuite) TestSetConfig(c *gc.C) {
479
480=== modified file 'provider/manual/export_test.go'
481--- provider/null/export_test.go 2014-01-30 03:18:20 +0000
482+++ provider/manual/export_test.go 2014-01-31 05:40:27 +0000
483@@ -1,8 +1,8 @@
484 // Copyright 2014 Canonical Ltd.
485 // Licensed under the AGPLv3, see LICENCE file for details.
486
487-package null
488+package manual
489
490 var (
491- ProviderInstance = nullProvider{}
492+ ProviderInstance = manualProvider{}
493 )
494
495=== modified file 'provider/manual/instance.go'
496--- provider/null/instance.go 2014-01-30 03:18:20 +0000
497+++ provider/manual/instance.go 2014-01-31 05:40:27 +0000
498@@ -1,50 +1,50 @@
499 // Copyright 2013 Canonical Ltd.
500 // Licensed under the AGPLv3, see LICENCE file for details.
501
502-package null
503+package manual
504
505 import (
506 "launchpad.net/juju-core/environs/manual"
507 "launchpad.net/juju-core/instance"
508 )
509
510-type nullBootstrapInstance struct {
511+type manualBootstrapInstance struct {
512 host string
513 }
514
515-func (nullBootstrapInstance) Id() instance.Id {
516+func (manualBootstrapInstance) Id() instance.Id {
517 // The only way to bootrap is via manual bootstrap.
518 return manual.BootstrapInstanceId
519 }
520
521-func (nullBootstrapInstance) Status() string {
522+func (manualBootstrapInstance) Status() string {
523 return ""
524 }
525
526-func (nullBootstrapInstance) Refresh() error {
527+func (manualBootstrapInstance) Refresh() error {
528 return nil
529 }
530
531-func (inst nullBootstrapInstance) Addresses() (addresses []instance.Address, err error) {
532+func (inst manualBootstrapInstance) Addresses() (addresses []instance.Address, err error) {
533 return manual.HostAddresses(inst.host)
534 }
535
536-func (inst nullBootstrapInstance) DNSName() (string, error) {
537+func (inst manualBootstrapInstance) DNSName() (string, error) {
538 return inst.host, nil
539 }
540
541-func (i nullBootstrapInstance) WaitDNSName() (string, error) {
542+func (i manualBootstrapInstance) WaitDNSName() (string, error) {
543 return i.DNSName()
544 }
545
546-func (nullBootstrapInstance) OpenPorts(machineId string, ports []instance.Port) error {
547- return nil
548-}
549-
550-func (nullBootstrapInstance) ClosePorts(machineId string, ports []instance.Port) error {
551- return nil
552-}
553-
554-func (nullBootstrapInstance) Ports(machineId string) ([]instance.Port, error) {
555+func (manualBootstrapInstance) OpenPorts(machineId string, ports []instance.Port) error {
556+ return nil
557+}
558+
559+func (manualBootstrapInstance) ClosePorts(machineId string, ports []instance.Port) error {
560+ return nil
561+}
562+
563+func (manualBootstrapInstance) Ports(machineId string) ([]instance.Port, error) {
564 return []instance.Port{}, nil
565 }
566
567=== modified file 'provider/manual/provider.go'
568--- provider/null/provider.go 2014-01-29 10:08:01 +0000
569+++ provider/manual/provider.go 2014-01-31 05:40:27 +0000
570@@ -1,7 +1,7 @@
571 // Copyright 2013 Canonical Ltd.
572 // Licensed under the AGPLv3, see LICENCE file for details.
573
574-package null
575+package manual
576
577 import (
578 "errors"
579@@ -9,19 +9,20 @@
580
581 "launchpad.net/juju-core/environs"
582 "launchpad.net/juju-core/environs/config"
583- "launchpad.net/juju-core/provider"
584 "launchpad.net/juju-core/utils"
585 )
586
587-type nullProvider struct{}
588+type manualProvider struct{}
589
590 func init() {
591- environs.RegisterProvider(provider.Null, nullProvider{})
592+ p := manualProvider{}
593+ environs.RegisterProvider("null", p)
594+ environs.RegisterProvider("manual", p)
595 }
596
597 var errNoBootstrapHost = errors.New("bootstrap-host must be specified")
598
599-func (p nullProvider) Prepare(cfg *config.Config) (environs.Environ, error) {
600+func (p manualProvider) Prepare(cfg *config.Config) (environs.Environ, error) {
601 if _, ok := cfg.UnknownAttrs()["storage-auth-key"].(string); !ok {
602 uuid, err := utils.NewUUID()
603 if err != nil {
604@@ -37,7 +38,7 @@
605 return p.Open(cfg)
606 }
607
608-func (p nullProvider) Open(cfg *config.Config) (environs.Environ, error) {
609+func (p manualProvider) Open(cfg *config.Config) (environs.Environ, error) {
610 envConfig, err := p.validate(cfg, nil)
611 if err != nil {
612 return nil, err
613@@ -45,8 +46,8 @@
614 return p.open(envConfig)
615 }
616
617-func (p nullProvider) open(cfg *environConfig) (environs.Environ, error) {
618- return &nullEnviron{cfg: cfg}, nil
619+func (p manualProvider) open(cfg *environConfig) (environs.Environ, error) {
620+ return &manualEnviron{cfg: cfg}, nil
621 }
622
623 func checkImmutableString(cfg, old *environConfig, key string) error {
624@@ -56,7 +57,7 @@
625 return nil
626 }
627
628-func (p nullProvider) validate(cfg, old *config.Config) (*environConfig, error) {
629+func (p manualProvider) validate(cfg, old *config.Config) (*environConfig, error) {
630 // Check for valid changes for the base config values.
631 if err := config.Validate(cfg, old); err != nil {
632 return nil, err
633@@ -92,7 +93,7 @@
634 return envConfig, nil
635 }
636
637-func (p nullProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error) {
638+func (p manualProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error) {
639 envConfig, err := p.validate(cfg, old)
640 if err != nil {
641 return nil, err
642@@ -100,10 +101,10 @@
643 return cfg.Apply(envConfig.attrs)
644 }
645
646-func (_ nullProvider) BoilerplateConfig() string {
647+func (_ manualProvider) BoilerplateConfig() string {
648 return `
649-"null":
650- type: "null"
651+manual:
652+ type: manual
653 # bootstrap-host holds the host name of the machine where the
654 # bootstrap machine agent will be started.
655 bootstrap-host: somehost.example.com
656@@ -128,7 +129,7 @@
657 `[1:]
658 }
659
660-func (p nullProvider) SecretAttrs(cfg *config.Config) (map[string]string, error) {
661+func (p manualProvider) SecretAttrs(cfg *config.Config) (map[string]string, error) {
662 envConfig, err := p.validate(cfg, nil)
663 if err != nil {
664 return nil, err
665@@ -138,7 +139,7 @@
666 return attrs, nil
667 }
668
669-func (_ nullProvider) PublicAddress() (string, error) {
670+func (_ manualProvider) PublicAddress() (string, error) {
671 // TODO(axw) 2013-09-10 bug #1222643
672 //
673 // eth0 may not be the desired interface for traffic to route
674@@ -147,6 +148,6 @@
675 return utils.GetAddressForInterface("eth0")
676 }
677
678-func (p nullProvider) PrivateAddress() (string, error) {
679+func (p manualProvider) PrivateAddress() (string, error) {
680 return p.PublicAddress()
681 }
682
683=== modified file 'provider/manual/provider_test.go'
684--- provider/null/provider_test.go 2014-01-29 10:08:01 +0000
685+++ provider/manual/provider_test.go 2014-01-31 05:40:27 +0000
686@@ -1,13 +1,13 @@
687 // Copyright 2014 Canonical Ltd.
688 // Licensed under the AGPLv3, see LICENCE file for details.
689
690-package null_test
691+package manual_test
692
693 import (
694 gc "launchpad.net/gocheck"
695
696 "launchpad.net/juju-core/environs/config"
697- "launchpad.net/juju-core/provider/null"
698+ "launchpad.net/juju-core/provider/manual"
699 jc "launchpad.net/juju-core/testing/checkers"
700 "launchpad.net/juju-core/testing/testbase"
701 "launchpad.net/juju-core/utils"
702@@ -20,11 +20,11 @@
703 var _ = gc.Suite(&providerSuite{})
704
705 func (s *providerSuite) TestPrepare(c *gc.C) {
706- minimal := null.MinimalConfigValues()
707+ minimal := manual.MinimalConfigValues()
708 delete(minimal, "storage-auth-key")
709 testConfig, err := config.New(config.UseDefaults, minimal)
710 c.Assert(err, gc.IsNil)
711- env, err := null.ProviderInstance.Prepare(testConfig)
712+ env, err := manual.ProviderInstance.Prepare(testConfig)
713 c.Assert(err, gc.IsNil)
714 cfg := env.Config()
715 key, _ := cfg.UnknownAttrs()["storage-auth-key"].(string)
716
717=== modified file 'provider/manual/suite_test.go'
718--- provider/null/suite_test.go 2014-01-30 02:58:24 +0000
719+++ provider/manual/suite_test.go 2014-01-31 05:40:27 +0000
720@@ -1,7 +1,7 @@
721 // Copyright 2013 Canonical Ltd.
722 // Licensed under the AGPLv3, see LICENCE file for details.
723
724-package null_test
725+package manual_test
726
727 import (
728 "testing"
729
730=== modified file 'provider/provider.go'
731--- provider/provider.go 2013-09-30 19:40:06 +0000
732+++ provider/provider.go 2014-01-31 05:40:27 +0000
733@@ -9,5 +9,10 @@
734
735 const (
736 Local = "local"
737- Null = "null"
738 )
739+
740+// IsManual returns true iff the specified provider
741+// type refers to the manual provider.
742+func IsManual(provider string) bool {
743+ return provider == "null" || provider == "manual"
744+}
745
746=== modified file 'state/machine.go'
747--- state/machine.go 2014-01-24 14:52:58 +0000
748+++ state/machine.go 2014-01-31 05:40:27 +0000
749@@ -224,13 +224,15 @@
750 return true, nil
751 }
752 // The bootstrap machine uses BootstrapNonce, so in that
753- // case we need to check if its provider type is "null".
754+ // case we need to check if its provider type is "manual".
755+ // We also check for "null", which is an alias for manual.
756 if m.doc.Id == "0" {
757 cfg, err := m.st.EnvironConfig()
758 if err != nil {
759 return false, err
760 }
761- return cfg.Type() == "null", nil
762+ t := cfg.Type()
763+ return t == "null" || t == "manual", nil
764 }
765 return false, nil
766 }

Subscribers

People subscribed via source and target branches

to status/vote changes: