Merge lp:~gmb/maas/useful-noconnectionerrors 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: 2962
Proposed branch: lp:~gmb/maas/useful-noconnectionerrors
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 64 lines (+10/-2)
3 files modified
src/maasserver/models/tests/test_nodegroup.py (+4/-0)
src/maasserver/rpc/__init__.py (+3/-1)
src/maasserver/rpc/regionservice.py (+3/-1)
To merge this branch: bzr merge lp:~gmb/maas/useful-noconnectionerrors
Reviewer Review Type Date Requested Status
Graham Binns (community) Approve
Raphaël Badin (community) Approve
Review via email: mp+234319@code.launchpad.net

Commit message

Make the NoConnectionsAvailable errors raised by NodeGroup methods return a useful error message for the sake of reporting things back to API clients.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Wouldn't it be enough to only change src/maasserver/rpc/__init__.py:getClientFor and src/maasserver/rpc/regionservice.py:getClientFor ?

review: Needs Information
Revision history for this message
Graham Binns (gmb) wrote :

Err… yes. And I saw that. And then I got sidetracked and forgot about it :).

Revision history for this message
Raphaël Badin (rvb) wrote :

Looks good, thanks.

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

The attempt to merge lp:~gmb/maas/useful-noconnectionerrors 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]
Get:2 http://security.ubuntu.com trusty-security Release [59.7 kB]
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: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 [59.7 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [43.9 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [10.8 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [138 kB]
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:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [47.2 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/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
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [118 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [83.7 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [317 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [201 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
Fetched 1,080 kB in 0s (1,886 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-ope...

Revision history for this message
Graham Binns (gmb) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/tests/test_nodegroup.py'
2--- src/maasserver/models/tests/test_nodegroup.py 2014-09-11 13:02:20 +0000
3+++ src/maasserver/models/tests/test_nodegroup.py 2014-09-11 16:06:39 +0000
4@@ -478,6 +478,7 @@
5 nodegroup = factory.make_NodeGroup()
6 poweraddr = factory.make_name('poweraddr')
7 password = factory.make_name('password')
8+
9 self.assertRaises(
10 NoConnectionsAvailable, nodegroup.add_virsh, poweraddr,
11 password)
12@@ -531,6 +532,7 @@
13 username = factory.make_name('user')
14 password = factory.make_name('password')
15 power_control = factory.make_name('power_control')
16+
17 self.assertRaises(
18 NoConnectionsAvailable, nodegroup.add_seamicro15k,
19 mac, username, password, power_control)
20@@ -580,6 +582,7 @@
21 host = factory.make_name('host')
22 username = factory.make_name('user')
23 password = factory.make_name('password')
24+
25 self.assertRaises(
26 NoConnectionsAvailable, nodegroup.enlist_nodes_from_mscm,
27 host, username, password)
28@@ -629,6 +632,7 @@
29 url = factory.make_url()
30 username = factory.make_name('user')
31 password = factory.make_name('password')
32+
33 self.assertRaises(
34 NoConnectionsAvailable, nodegroup.enlist_nodes_from_ucsm,
35 url, username, password)
36
37=== modified file 'src/maasserver/rpc/__init__.py'
38--- src/maasserver/rpc/__init__.py 2014-09-01 22:25:21 +0000
39+++ src/maasserver/rpc/__init__.py 2014-09-11 16:06:39 +0000
40@@ -39,7 +39,9 @@
41 try:
42 service = eventloop.services.getServiceNamed("rpc")
43 except KeyError:
44- raise exceptions.NoConnectionsAvailable()
45+ raise exceptions.NoConnectionsAvailable(
46+ "Unable to connect to cluster %s; no connections available." %
47+ uuid)
48 else:
49 return service.getClientFor(uuid, timeout=timeout)
50
51
52=== modified file 'src/maasserver/rpc/regionservice.py'
53--- src/maasserver/rpc/regionservice.py 2014-09-05 08:10:06 +0000
54+++ src/maasserver/rpc/regionservice.py 2014-09-11 16:06:39 +0000
55@@ -463,7 +463,9 @@
56
57 def cancelled(failure):
58 failure.trap(CancelledError)
59- raise exceptions.NoConnectionsAvailable()
60+ raise exceptions.NoConnectionsAvailable(
61+ "Unable to connect to cluster %s; no connections available." %
62+ uuid)
63
64 return d.addCallbacks(common.Client, cancelled)
65