Merge lp://staging/~dimitern/juju-core/fix-maas-pvd-conf into lp://staging/~juju/juju-core/trunk

Proposed by Dimiter Naydenov
Status: Merged
Merged at revision: 1156
Proposed branch: lp://staging/~dimitern/juju-core/fix-maas-pvd-conf
Merge into: lp://staging/~juju/juju-core/trunk
Diff against target: 45 lines (+26/-1)
2 files modified
environs/maas/environprovider.go (+5/-1)
environs/maas/environprovider_test.go (+21/-0)
To merge this branch: bzr merge lp://staging/~dimitern/juju-core/fix-maas-pvd-conf
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+158961@code.staging.launchpad.net

Description of the change

environs/maas: fix provider config

[Note: this was originally proposed as lp:~rvb/juju-core/fix-maas-pvd-conf in the following MP:
https://code.launchpad.net/~rvb/juju-core/fix-maas-pvd-conf/+merge/158938
Due to issues with lbox, rvba asked me to submit this for him. No changes made, except
merging latest trunk.]

This branch fixes a problem we saw happening in the MAAS lab while testing the MAAS provider. The symptom was that, after having installed the bootstrap node ok, Juju was unable to deploy any service. The error found in the bootstrap node's logs: http://paste.ubuntu.com/5709878/.

The problem is that, from this code in cmd/jujud/upgrade.go: http://paste.ubuntu.com/5710182/, environs/maas/environ.go:SetConfig ends up being called on a nil object. After investigating the problem, I found that environs/maas/environprovider.go:Open(), when the config is invalid, returns a interface that has a nil value but a non-nil type (http://golang.org/doc/faq#nil_error) and thus, in cmd/jujud/upgrade.go (see snippet above), 'environ.SetConfig(cfg)' gets called on a nil 'environ'.

https://codereview.appspot.com/8772043/

To post a comment you must log in.
Revision history for this message
Dimiter Naydenov (dimitern) wrote :
Download full text (3.5 KiB)

Reviewers: mp+158961_code.launchpad.net,

Message:
Please take a look.

Description:
environs/maas: fix provider config

[Note: this was originally proposed as
lp:~rvb/juju-core/fix-maas-pvd-conf in the following MP:
https://code.launchpad.net/~rvb/juju-core/fix-maas-pvd-conf/+merge/158938
Due to issues with lbox, rvba asked me to submit this for him. No
changes made, except
merging latest trunk.]

This branch fixes a problem we saw happening in the MAAS lab while
testing the MAAS provider. The symptom was that, after having installed
the bootstrap node ok, Juju was unable to deploy any service. The error
found in the bootstrap node's logs: http://paste.ubuntu.com/5709878/.

The problem is that, from this code in cmd/jujud/upgrade.go:
http://paste.ubuntu.com/5710182/, environs/maas/environ.go:SetConfig
ends up being called on a nil object. After investigating the problem, I
found that environs/maas/environprovider.go:Open(), when the config is
invalid, returns a interface that has a nil value but a non-nil type
(http://golang.org/doc/faq#nil_error) and thus, in cmd/jujud/upgrade.go
(see snippet above), 'environ.SetConfig(cfg)' gets called on a nil
'environ'.

https://code.launchpad.net/~dimitern/juju-core/fix-maas-pvd-conf/+merge/158961

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M environs/maas/environprovider.go
   M environs/maas/environprovider_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision:
<email address hidden>

Index: environs/maas/environprovider.go
=== modified file 'environs/maas/environprovider.go'
--- environs/maas/environprovider.go 2013-04-12 09:45:01 +0000
+++ environs/maas/environprovider.go 2013-04-15 11:20:15 +0000
@@ -19,7 +19,11 @@

  func (maasEnvironProvider) Open(cfg *config.Config) (environs.Environ,
error) {
   log.Debugf("environs/maas: opening environment %q.", cfg.Name())
- return NewEnviron(cfg)
+ env, err := NewEnviron(cfg)
+ if err != nil {
+ return nil, err
+ }
+ return env, nil
  }

  // Boilerplate config YAML. Don't mess with the indentation or add
newlines!

Index: environs/maas/environprovider_test.go
=== modified file 'environs/maas/environprovider_test.go'
--- environs/maas/environprovider_test.go 2013-04-11 10:33:21 +0000
+++ environs/maas/environprovider_test.go 2013-04-15 12:22:14 +0000
@@ -92,3 +92,24 @@
   c.Assert(err, IsNil)
   c.Check(privateAddress, Equals, hostname)
  }
+
+func (suite *EnvironProviderSuite)
TestOpenReturnsNilInterfaceUponFailure(c *C) {
+ testJujuHome := c.MkDir()
+ defer config.SetJujuHome(config.SetJujuHome(testJujuHome))
+ const oauth = "wrongly-formatted-oauth-string"
+ attrs := map[string]interface{}{
+ "maas-oauth": oauth,
+ "maas-server": "http://maas.example.com/maas/",
+ "name": "wheee",
+ "type": "maas",
+ "authorized-keys": "I-am-not-a-real...

Read more...

Revision history for this message
Dimiter Naydenov (dimitern) wrote :
Revision history for this message
Dimiter Naydenov (dimitern) wrote :

*** Submitted:

environs/maas: fix provider config

[Note: this was originally proposed as
lp:~rvb/juju-core/fix-maas-pvd-conf in the following MP:
https://code.launchpad.net/~rvb/juju-core/fix-maas-pvd-conf/+merge/158938
Due to issues with lbox, rvba asked me to submit this for him. No
changes made, except
merging latest trunk.]

This branch fixes a problem we saw happening in the MAAS lab while
testing the MAAS provider. The symptom was that, after having installed
the bootstrap node ok, Juju was unable to deploy any service. The error
found in the bootstrap node's logs: http://paste.ubuntu.com/5709878/.

The problem is that, from this code in cmd/jujud/upgrade.go:
http://paste.ubuntu.com/5710182/, environs/maas/environ.go:SetConfig
ends up being called on a nil object. After investigating the problem, I
found that environs/maas/environprovider.go:Open(), when the config is
invalid, returns a interface that has a nil value but a non-nil type
(http://golang.org/doc/faq#nil_error) and thus, in cmd/jujud/upgrade.go
(see snippet above), 'environ.SetConfig(cfg)' gets called on a nil
'environ'.

R=
CC=
https://codereview.appspot.com/8772043

https://codereview.appspot.com/8772043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches