Merge lp:~julian-edwards/maas/fix-power-error-message 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: 2974
Proposed branch: lp:~julian-edwards/maas/fix-power-error-message
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 30 lines (+5/-4)
2 files modified
src/maasserver/models/tests/test_node.py (+3/-3)
src/provisioningserver/power/poweraction.py (+2/-1)
To merge this branch: bzr merge lp:~julian-edwards/maas/fix-power-error-message
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+234408@code.launchpad.net

Commit message

Prevent template text getting dumped in error messages for power action failures as it obscures the error output itself.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

I think this also fixes bug 1363823.

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

So it does, thanks!

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

On Friday 12 Sep 2014 09:47:40 you wrote:
> Note that err.output will be a byte string and so should be decoded here,
> probably with the 'replace' error strategy.

Right, thanks for pointing that out, it's so easy to forget :(

Revision history for this message
Gavin Panella (allenap) wrote :

> Right, thanks for pointing that out, it's so easy to forget :(

I wish there was a way to prevent implicit encoding/decoding of byte and unicode strings in Python 2 :-(

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

The attempt to merge lp:~julian-edwards/maas/fix-power-error-message 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
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release
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
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages
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
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-pyinotify python-seamicroclient python-simplejson python-simplestreams python...

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_node.py'
2--- src/maasserver/models/tests/test_node.py 2014-09-12 02:32:45 +0000
3+++ src/maasserver/models/tests/test_node.py 2014-09-12 10:51:27 +0000
4@@ -1145,9 +1145,9 @@
5 self.assertEqual(description, reload_object(node).error_description)
6
7 def test_mark_failed_raises_for_unauthorized_node_status(self):
8- status = factory.pick_choice(
9- NODE_STATUS_CHOICES,
10- but_not=self.failed_statuses_mapping.keys())
11+ but_not = self.failed_statuses_mapping.keys()
12+ but_not.extend(self.failed_statuses_mapping.viewvalues())
13+ status = factory.pick_choice(NODE_STATUS_CHOICES, but_not=but_not)
14 node = factory.make_Node(status=status)
15 description = factory.make_name('error-description')
16 self.assertRaises(NodeStateViolation, node.mark_failed, description)
17
18=== modified file 'src/provisioningserver/power/poweraction.py'
19--- src/provisioningserver/power/poweraction.py 2014-09-12 01:27:55 +0000
20+++ src/provisioningserver/power/poweraction.py 2014-09-12 10:51:27 +0000
21@@ -47,7 +47,8 @@
22 if is_process_error:
23 message += " with return code %s" % err.returncode
24 if err.output:
25- message += ":\n" + err.output.strip()
26+ message += ":\n" + (
27+ err.output.decode("utf-8", "replace").strip())
28 else:
29 message += ":\n%s" % err
30 return cls(message)