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
=== added directory 'environs/local'
=== added file 'environs/local/environ-provider.go'
--- environs/local/environ-provider.go 1970-01-01 00:00:00 +0000
+++ environs/local/environ-provider.go 2013-06-30 23:00:36 +0000
@@ -0,0 +1,65 @@
1// Copyright 2013 Canonical Ltd.
2// Licensed under the AGPLv3, see LICENCE file for details.
3
4package local
5
6import (
7 "fmt"
8
9 "launchpad.net/juju-core/environs"
10 "launchpad.net/juju-core/environs/config"
11 "launchpad.net/juju-core/instance"
12 "launchpad.net/loggo"
13)
14
15var logger = loggo.GetLogger("juju.environs.local")
16
17var _ environs.EnvironProvider = (*environProvider)(nil)
18
19type environProvider struct{}
20
21var provider environProvider
22
23func init() {
24 environs.RegisterProvider("local", &environProvider{})
25}
26
27// Open implements environs.EnvironProvider.Open.
28func (environProvider) Open(cfg *config.Config) (environs.Environ, error) {
29 return nil, fmt.Errorf("not implemented")
30}
31
32// Validate implements environs.EnvironProvider.Validate.
33func (environProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error) {
34 return nil, fmt.Errorf("not implemented")
35}
36
37// BoilerplateConfig implements environs.EnvironProvider.BoilerplateConfig.
38func (environProvider) BoilerplateConfig() string {
39 return "not implemented"
40}
41
42// SecretAttrs implements environs.EnvironProvider.SecretAttrs.
43func (environProvider) SecretAttrs(cfg *config.Config) (map[string]interface{}, error) {
44 // don't have any secret attrs
45 return nil, nil
46}
47
48// Location specific methods that are able to be called by any instance that
49// has been created by this provider type. So a machine agent may well call
50// these methods to find out its own address or instance id.
51
52// PublicAddress implements environs.EnvironProvider.PublicAddress.
53func (environProvider) PublicAddress() (string, error) {
54 return "", fmt.Errorf("not implemented")
55}
56
57// PrivateAddress implements environs.EnvironProvider.PrivateAddress.
58func (environProvider) PrivateAddress() (string, error) {
59 return "", fmt.Errorf("not implemented")
60}
61
62// InstanceId implements environs.EnvironProvider.InstanceId.
63func (environProvider) InstanceId() (instance.Id, error) {
64 return "", fmt.Errorf("not implemented")
65}
066
=== added file 'environs/local/environ.go'
--- environs/local/environ.go 1970-01-01 00:00:00 +0000
+++ environs/local/environ.go 2013-06-30 23:00:36 +0000
@@ -0,0 +1,107 @@
1// Copyright 2013 Canonical Ltd.
2// Licensed under the AGPLv3, see LICENCE file for details.
3
4package local
5
6import (
7 "fmt"
8
9 "launchpad.net/juju-core/constraints"
10 "launchpad.net/juju-core/environs"
11 "launchpad.net/juju-core/environs/config"
12 "launchpad.net/juju-core/instance"
13 "launchpad.net/juju-core/state"
14 "launchpad.net/juju-core/state/api"
15)
16
17// localEnviron implements Environ.
18var _ environs.Environ = (*localEnviron)(nil)
19
20type localEnviron struct {
21 name string
22}
23
24// Name is specified in the Environ interface.
25func (env *localEnviron) Name() string {
26 return env.name
27}
28
29// Bootstrap is specified in the Environ interface.
30func (env *localEnviron) Bootstrap(cons constraints.Value) error {
31 return fmt.Errorf("not implemented")
32}
33
34// StateInfo is specified in the Environ interface.
35func (env *localEnviron) StateInfo() (*state.Info, *api.Info, error) {
36 return nil, nil, fmt.Errorf("not implemented")
37}
38
39// Config is specified in the Environ interface.
40func (env *localEnviron) Config() *config.Config {
41 panic("unimplemented")
42}
43
44// SetConfig is specified in the Environ interface.
45func (env *localEnviron) SetConfig(cfg *config.Config) error {
46 return fmt.Errorf("not implemented")
47}
48
49// StartInstance is specified in the Environ interface.
50func (env *localEnviron) StartInstance(
51 machineId, machineNonce, series string,
52 cons constraints.Value,
53 info *state.Info,
54 apiInfo *api.Info,
55) (instance.Instance, *instance.HardwareCharacteristics, error) {
56 return nil, nil, fmt.Errorf("not implemented")
57}
58
59// StopInstances is specified in the Environ interface.
60func (env *localEnviron) StopInstances([]instance.Instance) error {
61 return fmt.Errorf("not implemented")
62}
63
64// Instances is specified in the Environ interface.
65func (env *localEnviron) Instances(ids []instance.Id) ([]instance.Instance, error) {
66 return nil, fmt.Errorf("not implemented")
67}
68
69// AllInstances is specified in the Environ interface.
70func (env *localEnviron) AllInstances() ([]instance.Instance, error) {
71 return nil, fmt.Errorf("not implemented")
72}
73
74// Storage is specified in the Environ interface.
75func (env *localEnviron) Storage() environs.Storage {
76 panic("unimplemented")
77}
78
79// PublicStorage is specified in the Environ interface.
80func (env *localEnviron) PublicStorage() environs.StorageReader {
81 panic("unimplemented")
82}
83
84// Destroy is specified in the Environ interface.
85func (env *localEnviron) Destroy(insts []instance.Instance) error {
86 return fmt.Errorf("not implemented")
87}
88
89// OpenPorts is specified in the Environ interface.
90func (env *localEnviron) OpenPorts(ports []instance.Port) error {
91 return fmt.Errorf("not implemented")
92}
93
94// ClosePorts is specified in the Environ interface.
95func (env *localEnviron) ClosePorts(ports []instance.Port) error {
96 return fmt.Errorf("not implemented")
97}
98
99// Ports is specified in the Environ interface.
100func (env *localEnviron) Ports() ([]instance.Port, error) {
101 return nil, fmt.Errorf("not implemented")
102}
103
104// Provider is specified in the Environ interface.
105func (env *localEnviron) Provider() environs.EnvironProvider {
106 return &provider
107}
0108
=== added file 'environs/local/export_test.go'
--- environs/local/export_test.go 1970-01-01 00:00:00 +0000
+++ environs/local/export_test.go 2013-06-30 23:00:36 +0000
@@ -0,0 +1,6 @@
1// Copyright 2013 Canonical Ltd.
2// Licensed under the AGPLv3, see LICENCE file for details.
3
4package local
5
6var Provider = provider
07
=== added file 'environs/local/local_test.go'
--- environs/local/local_test.go 1970-01-01 00:00:00 +0000
+++ environs/local/local_test.go 2013-06-30 23:00:36 +0000
@@ -0,0 +1,29 @@
1// Copyright 2013 Canonical Ltd.
2// Licensed under the AGPLv3, see LICENCE file for details.
3
4package local_test
5
6import (
7 stdtesting "testing"
8
9 . "launchpad.net/gocheck"
10 "launchpad.net/juju-core/environs"
11 "launchpad.net/juju-core/environs/local"
12 "launchpad.net/juju-core/testing"
13)
14
15func TestLocal(t *stdtesting.T) {
16 TestingT(t)
17}
18
19type localSuite struct {
20 testing.LoggingSuite
21}
22
23var _ = Suite(&localSuite{})
24
25func (*localSuite) TestProviderRegistered(c *C) {
26 provider, error := environs.Provider("local")
27 c.Assert(error, IsNil)
28 c.Assert(provider, DeepEquals, &local.Provider)
29}

Subscribers

People subscribed via source and target branches

to status/vote changes: