Skip to content

Commit

Permalink
Merge pull request #2473 from waigani/fix-1376246-fail-deploy
Browse files Browse the repository at this point in the history
Fix 1376246: MAAS Failed deployment

Ensure maas.waitForNodeDeployment returns an error if the node
status is "Failed deployment". This PR relies on an updated gomaasapi
to report the correct node status:

https://code.launchpad.net/~waigani/gomaasapi/faildeploy/+merge/260786


(Review request: http://reviews.vapour.ws/r/1837/)
  • Loading branch information
jujubot committed Jun 2, 2015
2 parents 3f81a8e + 6c45658 commit 9a7f421
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dependencies.tsv
Expand Up @@ -50,6 +50,6 @@ gopkg.in/natefinch/npipe.v2 git e562d4ae5c2f838f9e7e406f7d9890d5b02467a9 2014-08
gopkg.in/yaml.v1 git 9f9df34309c04878acc86042b16630b0f696e1de 2014-09-24T16:16:07Z
launchpad.net/gnuflag bzr roger.peppe@canonical.com-20140716064605-pk32dnmfust02yab 13
launchpad.net/golxc bzr ian.booth@canonical.com-20141121040613-ztm1q0iy9rune3zt 13
launchpad.net/gomaasapi bzr ian.booth@canonical.com-20150113032002-n7hj4l5a9j9dzaa0 61
launchpad.net/gomaasapi bzr jesse.meek@canonical.com-20150602215105-oh5pin1u2qe8ct89 62
launchpad.net/gwacl bzr andrew.wilkins@canonical.com-20141203072923-27pcp2hckqyezbfe 242
launchpad.net/tomb bzr gustavo@niemeyer.net-20130531003818-70ikdgklbxopn8x4 17
3 changes: 3 additions & 0 deletions provider/maas/environ.go
Expand Up @@ -1021,6 +1021,9 @@ func (environ *maasEnviron) waitForNodeDeployment(id instance.Id) error {
if statusValues[systemId] == "Deployed" {
return nil
}
if statusValues[systemId] == "Failed deployment" {
return errors.Errorf("instance %q failed to deploy", id)
}
}
return errors.Errorf("instance %q is started but not deployed", id)
}
Expand Down
16 changes: 16 additions & 0 deletions provider/maas/environ_whitebox_test.go
Expand Up @@ -714,6 +714,22 @@ func (suite *environSuite) TestBootstrapNodeNotDeployed(c *gc.C) {
c.Assert(err, gc.ErrorMatches, "bootstrap instance started but did not change to Deployed state.*")
}

func (suite *environSuite) TestBootstrapNodeFailedDeploy(c *gc.C) {
suite.setupFakeTools(c)
env := suite.makeEnviron()
suite.testMAASObject.TestServer.NewNode(fmt.Sprintf(
`{"system_id": "thenode", "hostname": "host", "architecture": "%s/generic", "memory": 256, "cpu_count": 8}`,
version.Current.Arch),
)
lshwXML, err := suite.generateHWTemplate(map[string]ifaceInfo{"aa:bb:cc:dd:ee:f0": {0, "eth0", false}})
c.Assert(err, jc.ErrorIsNil)
suite.testMAASObject.TestServer.AddNodeDetails("thenode", lshwXML)
// Set the node status to "Failed deployment"
suite.testMAASObject.TestServer.ChangeNode("thenode", "status", "11")
err = bootstrap.Bootstrap(envtesting.BootstrapContext(c), env, bootstrap.BootstrapParams{})
c.Assert(err, gc.ErrorMatches, "bootstrap instance started but did not change to Deployed state. instance \"/api/.*/nodes/thenode/\" failed to deploy")
}

func (suite *environSuite) TestBootstrapFailsIfNoTools(c *gc.C) {
env := suite.makeEnviron()
// Disable auto-uploading by setting the agent version.
Expand Down

0 comments on commit 9a7f421

Please sign in to comment.