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
=== modified file 'src/maasserver/models/tests/test_nodegroup.py'
--- src/maasserver/models/tests/test_nodegroup.py 2014-09-11 13:02:20 +0000
+++ src/maasserver/models/tests/test_nodegroup.py 2014-09-11 16:06:39 +0000
@@ -478,6 +478,7 @@
478 nodegroup = factory.make_NodeGroup()478 nodegroup = factory.make_NodeGroup()
479 poweraddr = factory.make_name('poweraddr')479 poweraddr = factory.make_name('poweraddr')
480 password = factory.make_name('password')480 password = factory.make_name('password')
481
481 self.assertRaises(482 self.assertRaises(
482 NoConnectionsAvailable, nodegroup.add_virsh, poweraddr,483 NoConnectionsAvailable, nodegroup.add_virsh, poweraddr,
483 password)484 password)
@@ -531,6 +532,7 @@
531 username = factory.make_name('user')532 username = factory.make_name('user')
532 password = factory.make_name('password')533 password = factory.make_name('password')
533 power_control = factory.make_name('power_control')534 power_control = factory.make_name('power_control')
535
534 self.assertRaises(536 self.assertRaises(
535 NoConnectionsAvailable, nodegroup.add_seamicro15k,537 NoConnectionsAvailable, nodegroup.add_seamicro15k,
536 mac, username, password, power_control)538 mac, username, password, power_control)
@@ -580,6 +582,7 @@
580 host = factory.make_name('host')582 host = factory.make_name('host')
581 username = factory.make_name('user')583 username = factory.make_name('user')
582 password = factory.make_name('password')584 password = factory.make_name('password')
585
583 self.assertRaises(586 self.assertRaises(
584 NoConnectionsAvailable, nodegroup.enlist_nodes_from_mscm,587 NoConnectionsAvailable, nodegroup.enlist_nodes_from_mscm,
585 host, username, password)588 host, username, password)
@@ -629,6 +632,7 @@
629 url = factory.make_url()632 url = factory.make_url()
630 username = factory.make_name('user')633 username = factory.make_name('user')
631 password = factory.make_name('password')634 password = factory.make_name('password')
635
632 self.assertRaises(636 self.assertRaises(
633 NoConnectionsAvailable, nodegroup.enlist_nodes_from_ucsm,637 NoConnectionsAvailable, nodegroup.enlist_nodes_from_ucsm,
634 url, username, password)638 url, username, password)
635639
=== modified file 'src/maasserver/rpc/__init__.py'
--- src/maasserver/rpc/__init__.py 2014-09-01 22:25:21 +0000
+++ src/maasserver/rpc/__init__.py 2014-09-11 16:06:39 +0000
@@ -39,7 +39,9 @@
39 try:39 try:
40 service = eventloop.services.getServiceNamed("rpc")40 service = eventloop.services.getServiceNamed("rpc")
41 except KeyError:41 except KeyError:
42 raise exceptions.NoConnectionsAvailable()42 raise exceptions.NoConnectionsAvailable(
43 "Unable to connect to cluster %s; no connections available." %
44 uuid)
43 else:45 else:
44 return service.getClientFor(uuid, timeout=timeout)46 return service.getClientFor(uuid, timeout=timeout)
4547
4648
=== modified file 'src/maasserver/rpc/regionservice.py'
--- src/maasserver/rpc/regionservice.py 2014-09-05 08:10:06 +0000
+++ src/maasserver/rpc/regionservice.py 2014-09-11 16:06:39 +0000
@@ -463,7 +463,9 @@
463463
464 def cancelled(failure):464 def cancelled(failure):
465 failure.trap(CancelledError)465 failure.trap(CancelledError)
466 raise exceptions.NoConnectionsAvailable()466 raise exceptions.NoConnectionsAvailable(
467 "Unable to connect to cluster %s; no connections available." %
468 uuid)
467469
468 return d.addCallbacks(common.Client, cancelled)470 return d.addCallbacks(common.Client, cancelled)
469471