Merge lp:~thumper/juju-core/local-provider-skeleton into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 1363
Proposed branch: lp:~thumper/juju-core/local-provider-skeleton
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 227 lines (+207/-0)
4 files modified
environs/local/environ-provider.go (+65/-0)
environs/local/environ.go (+107/-0)
environs/local/export_test.go (+6/-0)
environs/local/local_test.go (+29/-0)
To merge this branch: bzr merge lp:~thumper/juju-core/local-provider-skeleton
Reviewer Review Type Date Requested Status
William Reade (community) Approve
Review via email: mp+171951@code.launchpad.net

Commit message

Add skeleton provider and environ for local.

https://codereview.appspot.com/10679045/

Description of the change

Add skeleton provider and environ for local.

https://codereview.appspot.com/10679045/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Reviewers: mp+171951_code.launchpad.net,

Message:
Please take a look.

Description:
Add skeleton provider and environ for local.

https://code.launchpad.net/~thumper/juju-core/local-provider-skeleton/+merge/171951

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   A environs/local/environ-provider.go
   A environs/local/environ.go
   A environs/local/local_test.go

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

LGTM with the tweak to the test

https://codereview.appspot.com/10679045/diff/2005/environs/local/local_test.go
File environs/local/local_test.go (right):

https://codereview.appspot.com/10679045/diff/2005/environs/local/local_test.go#newcode29
environs/local/local_test.go:29: c.Assert(error, IsNil)
Please assert that the returned provider really is a local provider

https://codereview.appspot.com/10679045/

Revision history for this message
William Reade (fwereade) wrote :
Revision history for this message
William Reade (fwereade) :
review: Approve
Revision history for this message
Tim Penhey (thumper) wrote :

Please take a look.

https://codereview.appspot.com/10679045/diff/2005/environs/local/local_test.go
File environs/local/local_test.go (right):

https://codereview.appspot.com/10679045/diff/2005/environs/local/local_test.go#newcode29
environs/local/local_test.go:29: c.Assert(error, IsNil)
On 2013/06/28 06:05:02, wallyworld wrote:
> Please assert that the returned provider really is a local provider

Done.

https://codereview.appspot.com/10679045/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'environs/local'
2=== added file 'environs/local/environ-provider.go'
3--- environs/local/environ-provider.go 1970-01-01 00:00:00 +0000
4+++ environs/local/environ-provider.go 2013-06-30 23:00:36 +0000
5@@ -0,0 +1,65 @@
6+// Copyright 2013 Canonical Ltd.
7+// Licensed under the AGPLv3, see LICENCE file for details.
8+
9+package local
10+
11+import (
12+ "fmt"
13+
14+ "launchpad.net/juju-core/environs"
15+ "launchpad.net/juju-core/environs/config"
16+ "launchpad.net/juju-core/instance"
17+ "launchpad.net/loggo"
18+)
19+
20+var logger = loggo.GetLogger("juju.environs.local")
21+
22+var _ environs.EnvironProvider = (*environProvider)(nil)
23+
24+type environProvider struct{}
25+
26+var provider environProvider
27+
28+func init() {
29+ environs.RegisterProvider("local", &environProvider{})
30+}
31+
32+// Open implements environs.EnvironProvider.Open.
33+func (environProvider) Open(cfg *config.Config) (environs.Environ, error) {
34+ return nil, fmt.Errorf("not implemented")
35+}
36+
37+// Validate implements environs.EnvironProvider.Validate.
38+func (environProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error) {
39+ return nil, fmt.Errorf("not implemented")
40+}
41+
42+// BoilerplateConfig implements environs.EnvironProvider.BoilerplateConfig.
43+func (environProvider) BoilerplateConfig() string {
44+ return "not implemented"
45+}
46+
47+// SecretAttrs implements environs.EnvironProvider.SecretAttrs.
48+func (environProvider) SecretAttrs(cfg *config.Config) (map[string]interface{}, error) {
49+ // don't have any secret attrs
50+ return nil, nil
51+}
52+
53+// Location specific methods that are able to be called by any instance that
54+// has been created by this provider type. So a machine agent may well call
55+// these methods to find out its own address or instance id.
56+
57+// PublicAddress implements environs.EnvironProvider.PublicAddress.
58+func (environProvider) PublicAddress() (string, error) {
59+ return "", fmt.Errorf("not implemented")
60+}
61+
62+// PrivateAddress implements environs.EnvironProvider.PrivateAddress.
63+func (environProvider) PrivateAddress() (string, error) {
64+ return "", fmt.Errorf("not implemented")
65+}
66+
67+// InstanceId implements environs.EnvironProvider.InstanceId.
68+func (environProvider) InstanceId() (instance.Id, error) {
69+ return "", fmt.Errorf("not implemented")
70+}
71
72=== added file 'environs/local/environ.go'
73--- environs/local/environ.go 1970-01-01 00:00:00 +0000
74+++ environs/local/environ.go 2013-06-30 23:00:36 +0000
75@@ -0,0 +1,107 @@
76+// Copyright 2013 Canonical Ltd.
77+// Licensed under the AGPLv3, see LICENCE file for details.
78+
79+package local
80+
81+import (
82+ "fmt"
83+
84+ "launchpad.net/juju-core/constraints"
85+ "launchpad.net/juju-core/environs"
86+ "launchpad.net/juju-core/environs/config"
87+ "launchpad.net/juju-core/instance"
88+ "launchpad.net/juju-core/state"
89+ "launchpad.net/juju-core/state/api"
90+)
91+
92+// localEnviron implements Environ.
93+var _ environs.Environ = (*localEnviron)(nil)
94+
95+type localEnviron struct {
96+ name string
97+}
98+
99+// Name is specified in the Environ interface.
100+func (env *localEnviron) Name() string {
101+ return env.name
102+}
103+
104+// Bootstrap is specified in the Environ interface.
105+func (env *localEnviron) Bootstrap(cons constraints.Value) error {
106+ return fmt.Errorf("not implemented")
107+}
108+
109+// StateInfo is specified in the Environ interface.
110+func (env *localEnviron) StateInfo() (*state.Info, *api.Info, error) {
111+ return nil, nil, fmt.Errorf("not implemented")
112+}
113+
114+// Config is specified in the Environ interface.
115+func (env *localEnviron) Config() *config.Config {
116+ panic("unimplemented")
117+}
118+
119+// SetConfig is specified in the Environ interface.
120+func (env *localEnviron) SetConfig(cfg *config.Config) error {
121+ return fmt.Errorf("not implemented")
122+}
123+
124+// StartInstance is specified in the Environ interface.
125+func (env *localEnviron) StartInstance(
126+ machineId, machineNonce, series string,
127+ cons constraints.Value,
128+ info *state.Info,
129+ apiInfo *api.Info,
130+) (instance.Instance, *instance.HardwareCharacteristics, error) {
131+ return nil, nil, fmt.Errorf("not implemented")
132+}
133+
134+// StopInstances is specified in the Environ interface.
135+func (env *localEnviron) StopInstances([]instance.Instance) error {
136+ return fmt.Errorf("not implemented")
137+}
138+
139+// Instances is specified in the Environ interface.
140+func (env *localEnviron) Instances(ids []instance.Id) ([]instance.Instance, error) {
141+ return nil, fmt.Errorf("not implemented")
142+}
143+
144+// AllInstances is specified in the Environ interface.
145+func (env *localEnviron) AllInstances() ([]instance.Instance, error) {
146+ return nil, fmt.Errorf("not implemented")
147+}
148+
149+// Storage is specified in the Environ interface.
150+func (env *localEnviron) Storage() environs.Storage {
151+ panic("unimplemented")
152+}
153+
154+// PublicStorage is specified in the Environ interface.
155+func (env *localEnviron) PublicStorage() environs.StorageReader {
156+ panic("unimplemented")
157+}
158+
159+// Destroy is specified in the Environ interface.
160+func (env *localEnviron) Destroy(insts []instance.Instance) error {
161+ return fmt.Errorf("not implemented")
162+}
163+
164+// OpenPorts is specified in the Environ interface.
165+func (env *localEnviron) OpenPorts(ports []instance.Port) error {
166+ return fmt.Errorf("not implemented")
167+}
168+
169+// ClosePorts is specified in the Environ interface.
170+func (env *localEnviron) ClosePorts(ports []instance.Port) error {
171+ return fmt.Errorf("not implemented")
172+}
173+
174+// Ports is specified in the Environ interface.
175+func (env *localEnviron) Ports() ([]instance.Port, error) {
176+ return nil, fmt.Errorf("not implemented")
177+}
178+
179+// Provider is specified in the Environ interface.
180+func (env *localEnviron) Provider() environs.EnvironProvider {
181+ return &provider
182+}
183
184=== added file 'environs/local/export_test.go'
185--- environs/local/export_test.go 1970-01-01 00:00:00 +0000
186+++ environs/local/export_test.go 2013-06-30 23:00:36 +0000
187@@ -0,0 +1,6 @@
188+// Copyright 2013 Canonical Ltd.
189+// Licensed under the AGPLv3, see LICENCE file for details.
190+
191+package local
192+
193+var Provider = provider
194
195=== added file 'environs/local/local_test.go'
196--- environs/local/local_test.go 1970-01-01 00:00:00 +0000
197+++ environs/local/local_test.go 2013-06-30 23:00:36 +0000
198@@ -0,0 +1,29 @@
199+// Copyright 2013 Canonical Ltd.
200+// Licensed under the AGPLv3, see LICENCE file for details.
201+
202+package local_test
203+
204+import (
205+ stdtesting "testing"
206+
207+ . "launchpad.net/gocheck"
208+ "launchpad.net/juju-core/environs"
209+ "launchpad.net/juju-core/environs/local"
210+ "launchpad.net/juju-core/testing"
211+)
212+
213+func TestLocal(t *stdtesting.T) {
214+ TestingT(t)
215+}
216+
217+type localSuite struct {
218+ testing.LoggingSuite
219+}
220+
221+var _ = Suite(&localSuite{})
222+
223+func (*localSuite) TestProviderRegistered(c *C) {
224+ provider, error := environs.Provider("local")
225+ c.Assert(error, IsNil)
226+ c.Assert(provider, DeepEquals, &local.Provider)
227+}

Subscribers

People subscribed via source and target branches

to status/vote changes: