Merge lp:~gmb/maas/fix-bubble into lp:~maas-committers/maas/trunk

Proposed by Graham Binns
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 3126
Proposed branch: lp:~gmb/maas/fix-bubble
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 57 lines (+13/-7)
2 files modified
src/provisioningserver/rpc/clusterservice.py (+6/-4)
src/provisioningserver/rpc/tests/test_clusterservice.py (+7/-3)
To merge this branch: bzr merge lp:~gmb/maas/fix-bubble
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+236373@code.launchpad.net

Commit message

Ensure that PowerActionAlreadyAvailable bubbles up properly from pserv rather than being dropped.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Looks good.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (18.8 KiB)

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

Ign http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security Release.gpg
Hit http://security.ubuntu.com trusty-security Release
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:1 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:2 http://nova.clouds.archive.ubuntu.com trusty-updates Release [59.7 kB]
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
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/main Sources
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:3 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [121 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [85.1 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [324 kB]
Get:6 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [205 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 796 kB in 0s (1,493 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 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 python-oops-wsgi python-openssl python-paramiko python-pexpect python-pip python-pocket-lint python-psycopg2 python-...

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Monday 29 Sep 2014 15:50:25 you wrote:
> > + def check(failure):
> > + failure.trap(exceptions.PowerActionAlreadyInProgress)
> > + return d.addErrback(check)
>
> This is fine, but assert_fails_with() is better

Especially when there's no errback and the test passes :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/rpc/clusterservice.py'
2--- src/provisioningserver/rpc/clusterservice.py 2014-09-27 13:03:54 +0000
3+++ src/provisioningserver/rpc/clusterservice.py 2014-09-29 16:19:16 +0000
4@@ -203,19 +203,21 @@
5 @cluster.PowerOn.responder
6 def power_on(self, system_id, hostname, power_type, context):
7 """Turn a node on."""
8- maybe_change_power_state(
9+ d = maybe_change_power_state(
10 system_id, hostname, power_type, power_change='on',
11 context=context)
12- return {}
13+ d.addCallback(lambda _: {})
14+ return d
15
16 @log_call(level=logging.DEBUG)
17 @cluster.PowerOff.responder
18 def power_off(self, system_id, hostname, power_type, context):
19 """Turn a node off."""
20- maybe_change_power_state(
21+ d = maybe_change_power_state(
22 system_id, hostname, power_type, power_change='off',
23 context=context)
24- return {}
25+ d.addCallback(lambda _: {})
26+ return d
27
28 @cluster.PowerQuery.responder
29 def power_query(self, system_id, hostname, power_type, context):
30
31=== modified file 'src/provisioningserver/rpc/tests/test_clusterservice.py'
32--- src/provisioningserver/rpc/tests/test_clusterservice.py 2014-09-27 16:12:10 +0000
33+++ src/provisioningserver/rpc/tests/test_clusterservice.py 2014-09-29 16:19:16 +0000
34@@ -93,7 +93,6 @@
35 )
36 from provisioningserver.testing.config import set_tftp_root
37 from testtools import ExpectedException
38-from testtools.deferredruntest import extract_result
39 from testtools.matchers import (
40 Contains,
41 Equals,
42@@ -1144,8 +1143,13 @@
43 "system_id": "id", "hostname": "hostname", "power_type": "type",
44 "context": {},
45 })
46- self.assertRaises(
47- exceptions.PowerActionAlreadyInProgress, extract_result, d)
48+ # If the call doesn't fail then we have a test failure; we're
49+ # *expecting* PowerActionFail to be raised.
50+ d.addCallback(self.fail)
51+
52+ def check(failure):
53+ failure.trap(exceptions.PowerActionAlreadyInProgress)
54+ return d.addErrback(check)
55
56
57 class TestClusterProtocol_PowerQuery(MAASTestCase):