Merge lp:~blake-rouse/maas/fix-1527634 into lp:~maas-committers/maas/trunk

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 4955
Proposed branch: lp:~blake-rouse/maas/fix-1527634
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 53 lines (+4/-12)
2 files modified
src/metadataserver/api.py (+2/-9)
src/metadataserver/tests/test_api_status.py (+2/-3)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1527634
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+292804@code.launchpad.net

Commit message

Fix cloud-init reporter endpoint so it doesn't end disk erasing early.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

In reality, this looks good to me, just have one question below before landing.

review: Approve
Revision history for this message
Blake Rouse (blake-rouse) :
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.0 MiB)

The attempt to merge lp:~blake-rouse/maas/fix-1527634 into lp:maas failed. Below is the output from the failed tests.

Hit:1 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [92.2 kB]
Hit:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [92.2 kB]
Fetched 184 kB in 0s (400 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind bash bind9 bind9utils build-essential bzr bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm postgresql pxelinux python3-all python3-apt python3-bson python3-convoy python3-coverage python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-dnspython python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-mock python3-netaddr python3-netifaces python3-oauth python3-oauthlib python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-requests python3-seamicroclient python3-setuptools python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-simplejson python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
bind9 is already the newest version (1:9.10.3.dfsg.P4-8).
bind9utils is already the newest version (1:9.10.3.dfsg.P4-8).
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.3.dfsg.P4-8).
firefox is already the newest version (45.0.2+build1-0ubuntu1).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is a...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/metadataserver/api.py'
2--- src/metadataserver/api.py 2016-03-28 13:54:47 +0000
3+++ src/metadataserver/api.py 2016-04-25 13:31:18 +0000
4@@ -358,20 +358,13 @@
5 "Installation failed (refer to the "
6 "installation log for more information).")
7 elif node.status == NODE_STATUS.DISK_ERASING:
8- # XXX mpontillo 2016-02-12 we need to check that
9- # only one "top level" event is sent during disk
10- # erasing.
11- if result == 'SUCCESS':
12- # disk erasing complete, release node.
13- node.release()
14- elif result in ['FAIL', 'FAILURE']:
15+ if result in ['FAIL', 'FAILURE']:
16 node.mark_failed(None, "Failed to erase disks.")
17
18 # Deallocate the node if we enter any terminal state.
19 if node.status in [
20 NODE_STATUS.READY,
21- NODE_STATUS.FAILED_COMMISSIONING,
22- NODE_STATUS.FAILED_DISK_ERASING]:
23+ NODE_STATUS.FAILED_COMMISSIONING]:
24 node.owner = None
25 node.error = 'failed: %s' % description
26
27
28=== modified file 'src/metadataserver/tests/test_api_status.py'
29--- src/metadataserver/tests/test_api_status.py 2016-03-28 13:54:47 +0000
30+++ src/metadataserver/tests/test_api_status.py 2016-04-25 13:31:18 +0000
31@@ -287,7 +287,7 @@
32 NODE_STATUS.FAILED_DISK_ERASING, reload_object(node).status)
33 self.assertThat(populate_tags_for_single_node, MockNotCalled())
34
35- def test_status_erasure_failure_clears_owner(self):
36+ def test_status_erasure_failure_doesnt_clear_owner(self):
37 user = factory.make_User()
38 node = factory.make_Node(
39 interface=True, status=NODE_STATUS.DISK_ERASING, owner=user)
40@@ -299,12 +299,11 @@
41 'name': 'cmd-erase',
42 'description': 'Erasing disk',
43 }
44- self.assertEqual(user, node.owner) # Node has an owner
45 response = call_status(client, node, payload)
46 self.assertEqual(http.client.OK, response.status_code)
47 self.assertEqual(
48 NODE_STATUS.FAILED_DISK_ERASING, reload_object(node).status)
49- self.assertIsNone(reload_object(node).owner)
50+ self.assertEqual(user, node.owner)
51
52 def test_status_with_file_bad_encoder_fails(self):
53 node = factory.make_Node(