Merge lp:~julian-edwards/maas/ignore-failure-from-new-bug-1386502 into lp:~maas-committers/maas/trunk

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 3333
Proposed branch: lp:~julian-edwards/maas/ignore-failure-from-new-bug-1386502
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 38 lines (+10/-0)
2 files modified
src/maasserver/models/node.py (+3/-0)
src/maasserver/models/tests/test_node.py (+7/-0)
To merge this branch: bzr merge lp:~julian-edwards/maas/ignore-failure-from-new-bug-1386502
Reviewer Review Type Date Requested Status
Newell Jensen (community) Approve
Review via email: mp+240534@code.launchpad.net

Commit message

Prevent any failures when a node is NEW from trying to actually mark the node as failed; there is no corresponding failed state, it just needs to stay at NEW. Previously, this would traceback in the appserver.

To post a comment you must log in.
Revision history for this message
Newell Jensen (newell-jensen) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (19.1 KiB)

The attempt to merge lp:~julian-edwards/maas/ignore-failure-from-new-bug-1386502 into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 http://security.ubuntu.com trusty-security Release [62.0 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [62.0 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [49.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [11.2 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [153 kB]
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [51.2 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [136 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [89.3 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [356 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [217 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,188 kB in 2s (398 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb curl daemontools debhelper dh-apport distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-raphael libjs-yui3-full libjs-yui3-min libpq-dev make pep8 postgresql pyflakes python-amqplib python-bzrlib python-celery python-convoy python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mimeparse python-mock python-netaddr python-netifaces python-nose python-oauth python-oops python-oops-amqp python-oops-datedir-repo python-oops-twisted pyth...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/node.py'
2--- src/maasserver/models/node.py 2014-10-30 00:39:21 +0000
3+++ src/maasserver/models/node.py 2014-11-04 04:51:34 +0000
4@@ -1300,6 +1300,9 @@
5 maaslog.error(
6 "%s: Marking node failed: %s", self.hostname,
7 error_description)
8+ elif self.status == NODE_STATUS.NEW:
9+ # Silently ignore, failing a new node makes no sense.
10+ pass
11 elif is_failed_status(self.status):
12 # Silently ignore a request to fail an already failed node.
13 pass
14
15=== modified file 'src/maasserver/models/tests/test_node.py'
16--- src/maasserver/models/tests/test_node.py 2014-10-30 00:39:21 +0000
17+++ src/maasserver/models/tests/test_node.py 2014-11-04 04:51:34 +0000
18@@ -1560,6 +1560,7 @@
19 def test_mark_failed_raises_for_unauthorized_node_status(self):
20 but_not = NODE_FAILURE_STATUS_TRANSITIONS.keys()
21 but_not.extend(NODE_FAILURE_STATUS_TRANSITIONS.viewvalues())
22+ but_not.append(NODE_STATUS.NEW)
23 status = factory.pick_choice(NODE_STATUS_CHOICES, but_not=but_not)
24 node = factory.make_Node(status=status)
25 description = factory.make_name('error-description')
26@@ -1573,6 +1574,12 @@
27 node.mark_failed(description)
28 self.assertEqual(status, node.status)
29
30+ def test_mark_failed_ignores_if_status_is_NEW(self):
31+ node = factory.make_Node(status=NODE_STATUS.NEW)
32+ description = factory.make_name('error-description')
33+ node.mark_failed(description)
34+ self.assertEqual(NODE_STATUS.NEW, node.status)
35+
36 def test_mark_broken_changes_status_to_broken(self):
37 node = factory.make_Node(
38 status=NODE_STATUS.NEW, owner=factory.make_User())