Merge lp:~jtv/juju-core/mpv-singleton into lp:~maas-maintainers/juju-core/maas-provider-skeleton

Proposed by Jeroen T. Vermeulen
Status: Rejected
Rejected by: Jeroen T. Vermeulen
Proposed branch: lp:~jtv/juju-core/mpv-singleton
Merge into: lp:~maas-maintainers/juju-core/maas-provider-skeleton
Diff against target: 52 lines (+13/-12)
2 files modified
environs/maas/environ.go (+1/-1)
environs/maas/environprovider.go (+12/-11)
To merge this branch: bzr merge lp:~jtv/juju-core/mpv-singleton
Reviewer Review Type Date Requested Status
MAAS Maintainers Pending
Review via email: mp+145777@code.launchpad.net

Commit message

Instantiate & register the MAAS environment provider. Make maasEnvironProvider, instead of *maasEnvironProvider, implement EnvironProvider.

Description of the change

This was cargo-culted off the EC2 provider: create a singleton instance of the maasEnvironProvider, and register it.

There is a difference, discussed with John Meinel: where the EC2 and OpenStack providers create a singleton instance but then register a separate instance, this code really uses just a single instance. We believe this is what the EC2 code intended. The OpenStack provider was cargo-culted off that one, so the fact that it does the same thing as the EC2 one is not particularly significant.

Jeroen

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

We discussed this some more, with Roger Peppe as well. Turns out the singleton is really just a holdover from the time before Environ.Provider(). That simplifies things a bit. Environ.Provider() can just hand out pointers to instances it creates on the fly.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'environs/maas/environ.go'
2--- environs/maas/environ.go 2013-01-29 09:51:16 +0000
3+++ environs/maas/environ.go 2013-01-31 08:38:21 +0000
4@@ -97,5 +97,5 @@
5 }
6
7 func (*maasEnviron) Provider() environs.EnvironProvider {
8- panic("Not implemented.")
9+ return &maasEnvironProvider{}
10 }
11
12=== modified file 'environs/maas/environprovider.go'
13--- environs/maas/environprovider.go 2013-01-31 06:27:18 +0000
14+++ environs/maas/environprovider.go 2013-01-31 08:38:21 +0000
15@@ -8,25 +8,26 @@
16
17 type maasEnvironProvider struct{}
18
19+// maasEnvironProvider implements EnvironProvider.
20 var _ environs.EnvironProvider = (*maasEnvironProvider)(nil)
21
22-func (*maasEnvironProvider) Open(cfg *config.Config) (environs.Environ, error) {
23+func (maasEnvironProvider) Open(cfg *config.Config) (environs.Environ, error) {
24 log.Printf("environs/maas: opening environment %q.", cfg.Name())
25 return NewEnviron(cfg)
26 }
27
28-func (*maasEnvironProvider) Validate(cfg, old *config.Config) (*config.Config, error) {
29+func (maasEnvironProvider) Validate(cfg, old *config.Config) (*config.Config, error) {
30 return cfg, nil
31 }
32
33-func (*maasEnvironProvider) SecretAttrs(*config.Config) (map[string]interface{}, error) {
34- panic("Not implemented.")
35-}
36-
37-func (*maasEnvironProvider) PublicAddress() (string, error) {
38- panic("Not implemented.")
39-}
40-
41-func (*maasEnvironProvider) PrivateAddress() (string, error) {
42+func (maasEnvironProvider) SecretAttrs(*config.Config) (map[string]interface{}, error) {
43+ panic("Not implemented.")
44+}
45+
46+func (maasEnvironProvider) PublicAddress() (string, error) {
47+ panic("Not implemented.")
48+}
49+
50+func (maasEnvironProvider) PrivateAddress() (string, error) {
51 panic("Not implemented.")
52 }

Subscribers

People subscribed via source and target branches

to all changes: