Merge lp:~allenap/maas/remove-make-validation-error-message into lp:~maas-committers/maas/trunk

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 5309
Proposed branch: lp:~allenap/maas/remove-make-validation-error-message
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 206 lines (+2/-94)
6 files modified
src/maasserver/utils/__init__.py (+0/-24)
src/maasserver/utils/tests/test_utils.py (+0/-17)
src/metadataserver/user_data/snippets.py (+1/-1)
src/provisioningserver/boot/__init__.py (+1/-1)
src/provisioningserver/utils/tests/test_text.py (+0/-35)
src/provisioningserver/utils/text.py (+0/-16)
To merge this branch: bzr merge lp:~allenap/maas/remove-make-validation-error-message
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
Review via email: mp+304452@code.launchpad.net

Commit message

Remove the unused make_validation_error_message function and the newly unused dependencies thereof.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Looks good.

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

The attempt to merge lp:~allenap/maas/remove-make-validation-error-message 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
Hit:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Fetched 94.5 kB in 0s (204 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind avahi-utils 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 isc-dhcp-server 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-attr python3-bson python3-convoy 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-netaddr python3-netifaces python3-novaclient 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...
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
avahi-utils is already the newest version (0.6.32~rc+dfsg-1ubuntu2).
build-essential is already the newest version (12.1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
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 already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
pxelinux is already the newest version (3:6.03+dfsg-11ubuntu1).
python-formencode is already the newest version (1.3.0-0ubuntu5).
python-lxml is already the newest version (3.5.0-1build1).
python-netaddr is alrea...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/utils/__init__.py'
2--- src/maasserver/utils/__init__.py 2016-03-28 13:54:47 +0000
3+++ src/maasserver/utils/__init__.py 2016-09-01 07:44:11 +0000
4@@ -5,12 +5,10 @@
5
6 __all__ = [
7 'absolute_reverse',
8- 'absolute_reverse_url',
9 'build_absolute_uri',
10 'find_rack_controller',
11 'get_local_cluster_UUID',
12 'ignore_unused',
13- 'make_validation_error_message',
14 'strip_domain',
15 'synchronised',
16 ]
17@@ -28,7 +26,6 @@
18 ClusterConfiguration,
19 UUID_NOT_SET,
20 )
21-from provisioningserver.utils.text import make_bullet_list
22
23
24 def ignore_unused(*args):
25@@ -165,24 +162,3 @@
26 return func(*args, **kwargs)
27 return call_with_lock
28 return synchronise
29-
30-
31-def gen_validation_error_messages(error):
32- """Return massaged messages from a :py:class:`ValidationError`."""
33- message_dict = error.message_dict
34- for field in sorted(message_dict):
35- field_messages = message_dict[field]
36- if field == "__all__":
37- for field_message in field_messages:
38- yield field_message
39- else:
40- for field_message in field_messages:
41- yield "%s: %s" % (field, field_message)
42-
43-
44-def make_validation_error_message(error):
45- """Return a massaged message from a :py:class:`ValidationError`.
46-
47- The message takes the form of a textual bullet-list.
48- """
49- return make_bullet_list(gen_validation_error_messages(error))
50
51=== modified file 'src/maasserver/utils/tests/test_utils.py'
52--- src/maasserver/utils/tests/test_utils.py 2016-05-12 19:07:37 +0000
53+++ src/maasserver/utils/tests/test_utils.py 2016-09-01 07:44:11 +0000
54@@ -13,7 +13,6 @@
55 urlparse,
56 )
57
58-from django.core.exceptions import ValidationError
59 from django.core.urlresolvers import reverse
60 from django.http import HttpRequest
61 from django.test.client import RequestFactory
62@@ -26,7 +25,6 @@
63 build_absolute_uri,
64 find_rack_controller,
65 get_local_cluster_UUID,
66- make_validation_error_message,
67 strip_domain,
68 synchronised,
69 )
70@@ -254,18 +252,3 @@
71 self.assertFalse(lock.locked())
72 self.assertEqual(sentinel.called, example_synchronised_function())
73 self.assertFalse(lock.locked())
74-
75-
76-class TestMakeValidationErrorMessage(MAASTestCase):
77-
78- def test__formats_message_with_all_errors(self):
79- error = ValidationError({
80- "foo": [ValidationError("bar")],
81- "alice": [ValidationError("bob")],
82- "__all__": ["all is lost"],
83- })
84- self.assertEqual(
85- "* all is lost\n"
86- "* alice: bob\n"
87- "* foo: bar",
88- make_validation_error_message(error))
89
90=== modified file 'src/metadataserver/user_data/snippets.py'
91--- src/metadataserver/user_data/snippets.py 2016-08-25 17:30:31 +0000
92+++ src/metadataserver/user_data/snippets.py 2016-09-01 07:44:11 +0000
93@@ -1,4 +1,4 @@
94-# Copyright 2013-2015 Canonical Ltd. This software is licensed under the
95+# Copyright 2013-2016 Canonical Ltd. This software is licensed under the
96 # GNU Affero General Public License version 3 (see the file LICENSE).
97
98 """Low-level routines for access to snippets.
99
100=== modified file 'src/provisioningserver/boot/__init__.py'
101--- src/provisioningserver/boot/__init__.py 2016-08-25 20:14:49 +0000
102+++ src/provisioningserver/boot/__init__.py 2016-09-01 07:44:11 +0000
103@@ -1,4 +1,4 @@
104-# Copyright 2012-2015 Canonical Ltd. This software is licensed under the
105+# Copyright 2012-2016 Canonical Ltd. This software is licensed under the
106 # GNU Affero General Public License version 3 (see the file LICENSE).
107
108 """Boot Methods."""
109
110=== modified file 'src/provisioningserver/utils/tests/test_text.py'
111--- src/provisioningserver/utils/tests/test_text.py 2016-08-09 21:59:28 +0000
112+++ src/provisioningserver/utils/tests/test_text.py 2016-09-01 07:44:11 +0000
113@@ -6,14 +6,12 @@
114 __all__ = []
115
116 import string
117-from textwrap import dedent
118
119 import hypothesis
120 import hypothesis.strategies
121 from maastesting.factory import factory
122 from maastesting.testcase import MAASTestCase
123 from provisioningserver.utils.text import (
124- make_bullet_list,
125 normalise_to_comma_list,
126 normalise_whitespace,
127 split_string_list,
128@@ -43,39 +41,6 @@
129 self.assertEqual(punctuation, normalise_whitespace(punctuation))
130
131
132-class TestMakeBulletList(MAASTestCase):
133-
134- def test__returns_empty_string_when_there_are_no_messages(self):
135- self.assertEqual("", make_bullet_list([]))
136-
137- def test__wraps_at_72_columns(self):
138- lines = make_bullet_list([" -" * 50]).splitlines()
139- self.assertEqual(72, max(len(line) for line in lines))
140-
141- def test__fills_and_formats(self):
142- messages = [
143- """Lorem ipsum dolor sit amet, consectetur adipiscing elit.
144- Maecenas a lorem pellentesque, dapibus lorem ut, blandit ex.""",
145- """Nulla tristique quam sed suscipit cursus""",
146- """Integer euismod viverra ipsum, id placerat ante interdum vitae.
147- Mauris fermentum ut nisi vitae tincidunt. Maecenas posuere lacus
148- vel est dignissim vehicula. Vestibulum tristique, massa non
149- facilisis mattis, nisi lacus lacinia neque, nec convallis risus
150- turpis id metus. Aenean semper sapien sed volutpat volutpat.""",
151- ]
152- bullet_list = make_bullet_list(messages)
153- bullet_list_expected = dedent("""\
154- * Lorem ipsum dolor sit amet, consectetur adipiscing elit.
155- Maecenas a lorem pellentesque, dapibus lorem ut, blandit ex.
156- * Nulla tristique quam sed suscipit cursus
157- * Integer euismod viverra ipsum, id placerat ante interdum vitae.
158- Mauris fermentum ut nisi vitae tincidunt. Maecenas posuere lacus
159- vel est dignissim vehicula. Vestibulum tristique, massa non
160- facilisis mattis, nisi lacus lacinia neque, nec convallis risus
161- turpis id metus. Aenean semper sapien sed volutpat volutpat.""")
162- self.assertEqual(bullet_list_expected, bullet_list)
163-
164-
165 class TestNormaliseToCommaList(MAASTestCase):
166 """Tests for `normalise_to_comma_list`."""
167
168
169=== modified file 'src/provisioningserver/utils/text.py'
170--- src/provisioningserver/utils/text.py 2016-08-09 21:59:28 +0000
171+++ src/provisioningserver/utils/text.py 2016-09-01 07:44:11 +0000
172@@ -4,14 +4,12 @@
173 """Text-processing utilities."""
174
175 __all__ = [
176- 'make_bullet_list',
177 'normalise_whitespace',
178 'normalise_to_comma_list',
179 'split_string_list',
180 ]
181
182 import re
183-from textwrap import TextWrapper
184
185
186 def normalise_whitespace(text):
187@@ -19,20 +17,6 @@
188 return ' '.join(text.split())
189
190
191-def make_bullet_list(messages):
192- """Join `messages` into a bullet list.
193-
194- Each message is reformatted to 70 columns wide, indented by 2 columns,
195- making 72 columns in all. The first line of each message is denoted by a
196- asterisk in the first column.
197-
198- :type messages: An iterable of strings.
199- :return: A string.
200- """
201- fill = TextWrapper(72, initial_indent="* ", subsequent_indent=" ").fill
202- return "\n".join(fill(message) for message in messages)
203-
204-
205 def normalise_to_comma_list(string):
206 """Take a space- or comma-separated list and return a comma-separated list.
207