Merge lp:~mpontillo/maas/ipranges-missing-type-bug-1573660 into lp:~maas-committers/maas/trunk
- ipranges-missing-type-bug-1573660
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Mike Pontillo |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4957 |
Proposed branch: | lp:~mpontillo/maas/ipranges-missing-type-bug-1573660 |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
47 lines (+20/-2) 2 files modified
src/maasserver/api/tests/test_ipranges.py (+13/-0) src/maasserver/models/iprange.py (+7/-2) |
To merge this branch: | bzr merge lp:~mpontillo/maas/ipranges-missing-type-bug-1573660 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Blake Rouse (community) | Approve | ||
Review via email: mp+292869@code.launchpad.net |
Commit message
Fix error message when IPRange type is missing to not include confusing information about the valid start/end IP addresses. (we can't really determine anything about the validity of those until we know we have a valid type.)
Description of the change
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~mpontillo/maas/ipranges-missing-type-bug-1573660 into lp:maas failed. Below is the output from the failed tests.
Get:1 http://
Hit:2 http://
Get:3 http://
Hit:4 http://
Fetched 184 kB in 0s (378 kB/s)
Reading package lists...
sudo DEBIAN_
--no-
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
bind9 is already the newest version (1:9.10.
bind9utils is already the newest version (1:9.10.
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubun
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.
firefox is already the newest version (45.0.2+
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
...
Mike Pontillo (mpontillo) wrote : | # |
Sigh. Random failures:
maasserver.
maasserver.
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~mpontillo/maas/ipranges-missing-type-bug-1573660 into lp:maas failed. Below is the output from the failed tests.
Get:1 http://
Hit:2 http://
Get:3 http://
Hit:4 http://
Fetched 184 kB in 0s (382 kB/s)
Reading package lists...
sudo DEBIAN_
--no-
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
bind9 is already the newest version (1:9.10.
bind9utils is already the newest version (1:9.10.
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubun
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.
firefox is already the newest version (45.0.2+
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
...
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~mpontillo/maas/ipranges-missing-type-bug-1573660 into lp:maas failed. Below is the output from the failed tests.
Get:1 http://
Hit:2 http://
Get:3 http://
Hit:4 http://
Fetched 184 kB in 0s (414 kB/s)
Reading package lists...
sudo DEBIAN_
--no-
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
bind9 is already the newest version (1:9.10.
bind9utils is already the newest version (1:9.10.
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubun
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.
firefox is already the newest version (45.0.2+
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
...
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~mpontillo/maas/ipranges-missing-type-bug-1573660 into lp:maas failed. Below is the output from the failed tests.
Hit:1 http://
Get:2 http://
Hit:3 http://
Get:4 http://
Fetched 184 kB in 0s (397 kB/s)
Reading package lists...
sudo DEBIAN_
--no-
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
bind9 is already the newest version (1:9.10.
bind9utils is already the newest version (1:9.10.
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubun
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.
firefox is already the newest version (45.0.2+
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
...
Preview Diff
1 | === modified file 'src/maasserver/api/tests/test_ipranges.py' | |||
2 | --- src/maasserver/api/tests/test_ipranges.py 2016-04-11 16:23:26 +0000 | |||
3 | +++ src/maasserver/api/tests/test_ipranges.py 2016-04-26 00:06:28 +0000 | |||
4 | @@ -92,6 +92,19 @@ | |||
5 | 92 | self.assertThat(data['end_ip'], Equals('10.0.0.20')) | 92 | self.assertThat(data['end_ip'], Equals('10.0.0.20')) |
6 | 93 | self.assertThat(data['subnet']['id'], Equals(subnet.id)) | 93 | self.assertThat(data['subnet']['id'], Equals(subnet.id)) |
7 | 94 | 94 | ||
8 | 95 | def test_create_requires_type_and_reports_simple_error_if_missing(self): | ||
9 | 96 | self.become_admin() | ||
10 | 97 | uri = get_ipranges_uri() | ||
11 | 98 | factory.make_Subnet(cidr='10.0.0.0/24') | ||
12 | 99 | response = self.client.post(uri, { | ||
13 | 100 | "start_ip": "10.0.0.10", | ||
14 | 101 | "end_ip": "10.0.0.20", | ||
15 | 102 | }) | ||
16 | 103 | self.assertEqual( | ||
17 | 104 | http.client.BAD_REQUEST, response.status_code, response.content) | ||
18 | 105 | self.assertThat(response.content, Equals( | ||
19 | 106 | b'{"type": ["This field is required."]}')) | ||
20 | 107 | |||
21 | 95 | 108 | ||
22 | 96 | class TestIPRangeAPI(APITestCase): | 109 | class TestIPRangeAPI(APITestCase): |
23 | 97 | 110 | ||
24 | 98 | 111 | ||
25 | === modified file 'src/maasserver/models/iprange.py' | |||
26 | --- src/maasserver/models/iprange.py 2016-04-11 16:23:26 +0000 | |||
27 | +++ src/maasserver/models/iprange.py 2016-04-26 00:06:28 +0000 | |||
28 | @@ -183,12 +183,17 @@ | |||
29 | 183 | validation_errors[field] = [message] | 183 | validation_errors[field] = [message] |
30 | 184 | raise ValidationError(validation_errors) | 184 | raise ValidationError(validation_errors) |
31 | 185 | 185 | ||
32 | 186 | # Check against the valid types before going further, since whether | ||
33 | 187 | # or not the range overlaps anything that could cause an error heavily | ||
34 | 188 | # depends on its type. | ||
35 | 189 | valid_types = {choice[0] for choice in IPRANGE_TYPE_CHOICES} | ||
36 | 186 | """Make sure the new or updated range isn't going to cause a conflict. | 190 | """Make sure the new or updated range isn't going to cause a conflict. |
37 | 187 | If it will, raise ValidationError. | 191 | If it will, raise ValidationError. |
38 | 188 | """ | 192 | """ |
39 | 189 | # If model is incomplete, save() will fail, so don't bother checking. | 193 | # If model is incomplete, save() will fail, so don't bother checking. |
42 | 190 | if self.subnet_id is None or self.start_ip is None or ( | 194 | if (self.subnet_id is None or self.start_ip is None or |
43 | 191 | self.end_ip is None) or self.type is None: | 195 | self.end_ip is None or self.type is None or |
44 | 196 | self.type not in valid_types): | ||
45 | 192 | return | 197 | return |
46 | 193 | 198 | ||
47 | 194 | # The _state.adding flag is False if this instance exists in the DB. | 199 | # The _state.adding flag is False if this instance exists in the DB. |
Looks good.