← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/juju-core/fix-env-prov into lp:~maas-maintainers/juju-core/maas-provider-skeleton

 

Raphaël Badin has proposed merging lp:~rvb/juju-core/fix-env-prov into lp:~maas-maintainers/juju-core/maas-provider-skeleton with lp:~rvb/juju-core/instanceID as a prerequisite.

Commit message:
Change maasEnvironProvider's method to use a value receiver.  Call environs.RegisterProvider() with a new instance of maasEnvironProvider.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~rvb/juju-core/fix-env-prov/+merge/157092

Jeroen and I found that problem while trying to find the source of the nil-pointer error: http://paste.ubuntu.com/5676045/.   We're still not really sure why this fixes the problem (!) but this is similar to what is done in the other providers.
-- 
https://code.launchpad.net/~rvb/juju-core/fix-env-prov/+merge/157092
Your team MAAS Maintainers is requested to review the proposed merge of lp:~rvb/juju-core/fix-env-prov into lp:~maas-maintainers/juju-core/maas-provider-skeleton.
=== modified file 'environs/maas/environprovider.go'
--- environs/maas/environprovider.go	2013-04-04 12:32:23 +0000
+++ environs/maas/environprovider.go	2013-04-04 12:32:23 +0000
@@ -15,21 +15,21 @@
 var providerInstance maasEnvironProvider
 
 func init() {
-	environs.RegisterProvider("maas", &providerInstance)
+	environs.RegisterProvider("maas", maasEnvironProvider{})
 }
 
-func (*maasEnvironProvider) Open(cfg *config.Config) (environs.Environ, error) {
+func (maasEnvironProvider) Open(cfg *config.Config) (environs.Environ, error) {
 	log.Printf("environs/maas: opening environment %q.", cfg.Name())
 	return NewEnviron(cfg)
 }
 
 // BoilerplateConfig is specified in the EnvironProvider interface.
-func (*maasEnvironProvider) BoilerplateConfig() string {
+func (maasEnvironProvider) BoilerplateConfig() string {
 	panic("Not implemented.")
 }
 
 // SecretAttrs is specified in the EnvironProvider interface.
-func (prov *maasEnvironProvider) SecretAttrs(cfg *config.Config) (map[string]interface{}, error) {
+func (prov maasEnvironProvider) SecretAttrs(cfg *config.Config) (map[string]interface{}, error) {
 	secretAttrs := make(map[string]interface{})
 	maasCfg, err := prov.newConfig(cfg)
 	if err != nil {
@@ -40,17 +40,17 @@
 }
 
 // PublicAddress is specified in the EnvironProvider interface.
-func (*maasEnvironProvider) PublicAddress() (string, error) {
+func (maasEnvironProvider) PublicAddress() (string, error) {
 	panic("Not implemented.")
 }
 
 // PrivateAddress is specified in the EnvironProvider interface.
-func (*maasEnvironProvider) PrivateAddress() (string, error) {
+func (maasEnvironProvider) PrivateAddress() (string, error) {
 	panic("Not implemented.")
 }
 
 // InstanceId is specified in the EnvironProvider interface.
-func (*maasEnvironProvider) InstanceId() (state.InstanceId, error) {
+func (maasEnvironProvider) InstanceId() (state.InstanceId, error) {
 	content, err := ioutil.ReadFile(_MAASInstanceIDFilename)
 	if err != nil {
 		return "", err