Merge lp:~jtv/maas/whittle-away-get_managed_interface into lp:~maas-committers/maas/trunk

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 1851
Proposed branch: lp:~jtv/maas/whittle-away-get_managed_interface
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 178 lines (+20/-19)
6 files modified
src/maasserver/models/tests/test_nodegroupinterface.py (+6/-5)
src/maasserver/testing/factory.py (+2/-2)
src/maasserver/tests/test_api.py (+6/-6)
src/maasserver/tests/test_dhcp.py (+2/-2)
src/maasserver/tests/test_forms.py (+1/-1)
src/maasserver/utils/tests/test_utils.py (+3/-3)
To merge this branch: bzr merge lp:~jtv/maas/whittle-away-get_managed_interface
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+203314@code.launchpad.net

Commit message

Remove incidental uses of NodeGroup.get_managed_interface().

Description of the change

NodeGroup.get_managed_interface() is going away. It's being replaced with get_mangaed_interfaces() (plural). Several other branches currently waiting for review or landing remove more complex uses of the old method, but the branch you see here updates tests.

Once all these pending branches have landed, we can actually remove get_managed_interface() and its tests. That's one of the milestones in support for multiple managed interfaces per nodegroup.

Jeroen

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

> That's one of the milestones in support for multiple managed interfaces per nodegroup.

Right, another milestone is the removal of the clean_management() method which actually prevents multiple managed interface on a single nodegroup. But we will remove this one once the multiple-managed interface per nodegroup feature will be more advanced and will have undergone full scale testing.

review: Approve
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

That's in the "switchover" part of the document. There are other jobs there as well, which all belong together in one functional change. The tasks I put on the board were only those that can be done immediately, in preparation of the switchover.

Revision history for this message
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~jtv/maas/whittle-away-get_managed_interface 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
Get:1 http://nova.clouds.archive.ubuntu.com trusty Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg
Get:2 http://nova.clouds.archive.ubuntu.com trusty Release [58.5 kB]
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
Get:3 http://nova.clouds.archive.ubuntu.com trusty/main Sources [1,055 kB]
Ign http://security.ubuntu.com trusty-security/main Translation-en_US
Ign http://security.ubuntu.com trusty-security/universe Translation-en_US
Get:4 http://nova.clouds.archive.ubuntu.com trusty/universe Sources [6,400 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages [1,317 kB]
Get:6 http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages [5,867 kB]
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
Ign http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en_US
Fetched 14.7 MB in 6s (2,234 kB/s)

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

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_nodegroupinterface.py'
2--- src/maasserver/models/tests/test_nodegroupinterface.py 2013-10-18 16:57:37 +0000
3+++ src/maasserver/models/tests/test_nodegroupinterface.py 2014-01-27 12:53:33 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
6+# Copyright 2012-2014 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 """Tests for :class:`NodeGroupInterface`."""
10@@ -31,7 +31,8 @@
11 nodegroup = factory.make_node_group(
12 status=NODEGROUP_STATUS.ACCEPTED,
13 management=NODEGROUPINTERFACE_MANAGEMENT.DHCP_AND_DNS)
14- return nodegroup.get_managed_interface()
15+ [interface] = nodegroup.get_managed_interfaces()
16+ return interface
17
18
19 class TestNodeGroupInterface(MAASServerTestCase):
20@@ -76,7 +77,7 @@
21 ]
22 for field in checked_fields:
23 nodegroup = factory.make_node_group(network=network)
24- interface = nodegroup.get_managed_interface()
25+ [interface] = nodegroup.get_managed_interfaces()
26 ip = '192.168.2.1'
27 setattr(interface, field, '192.168.2.1')
28 message = (
29@@ -89,7 +90,7 @@
30 def test_clean_network(self):
31 nodegroup = factory.make_node_group(
32 network=IPNetwork('192.168.0.3/24'))
33- interface = nodegroup.get_managed_interface()
34+ [interface] = nodegroup.get_managed_interfaces()
35 # Set a bogus subnet mask.
36 interface.subnet_mask = '0.9.0.4'
37 message = 'invalid IPNetwork 192.168.0.255/0.9.0.4'
38@@ -142,7 +143,7 @@
39 nodegroup = factory.make_node_group(
40 network=network,
41 management=NODEGROUPINTERFACE_MANAGEMENT.DHCP_AND_DNS)
42- interface = nodegroup.get_managed_interface()
43+ [interface] = nodegroup.get_managed_interfaces()
44 setattr(interface, field, '')
45 exception = self.assertRaises(
46 ValidationError, interface.full_clean)
47
48=== modified file 'src/maasserver/testing/factory.py'
49--- src/maasserver/testing/factory.py 2014-01-21 06:08:12 +0000
50+++ src/maasserver/testing/factory.py 2014-01-27 12:53:33 +0000
51@@ -1,4 +1,4 @@
52-# Copyright 2013 Canonical Ltd. This software is licensed under the
53+# Copyright 2013-2014 Canonical Ltd. This software is licensed under the
54 # GNU Affero General Public License version 3 (see the file LICENSE).
55
56 """Test object factories."""
57@@ -257,7 +257,7 @@
58 name = self.make_name('original-name')
59 nodegroup = self.make_node_group(
60 name=name, status=NODEGROUP_STATUS.ACCEPTED)
61- interface = nodegroup.get_managed_interface()
62+ [interface] = nodegroup.get_managed_interfaces()
63 interface.management = NODEGROUPINTERFACE_MANAGEMENT.DHCP_AND_DNS
64 interface.save()
65 node = self.make_node(
66
67=== modified file 'src/maasserver/tests/test_api.py'
68--- src/maasserver/tests/test_api.py 2014-01-21 06:08:12 +0000
69+++ src/maasserver/tests/test_api.py 2014-01-27 12:53:33 +0000
70@@ -1,4 +1,4 @@
71-# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
72+# Copyright 2012-2014 Canonical Ltd. This software is licensed under the
73 # GNU Affero General Public License version 3 (see the file LICENSE).
74
75 """Test maasserver API."""
76@@ -657,7 +657,7 @@
77 def test_read_interface(self):
78 self.become_admin()
79 nodegroup = factory.make_node_group()
80- interface = nodegroup.get_managed_interface()
81+ [interface] = nodegroup.get_managed_interfaces()
82 response = self.client.get(
83 reverse(
84 'nodegroupinterface_handler',
85@@ -671,7 +671,7 @@
86 def test_update_interface(self):
87 self.become_admin()
88 nodegroup = factory.make_node_group()
89- interface = nodegroup.get_managed_interface()
90+ [interface] = nodegroup.get_managed_interfaces()
91 get_ip_in_network = partial(
92 factory.getRandomIPInNetwork, interface.network)
93 new_ip_range_high = next(
94@@ -689,7 +689,7 @@
95 def test_delete_interface(self):
96 self.become_admin()
97 nodegroup = factory.make_node_group()
98- interface = nodegroup.get_managed_interface()
99+ [interface] = nodegroup.get_managed_interfaces()
100 response = self.client.delete(
101 reverse(
102 'nodegroupinterface_handler',
103@@ -702,7 +702,7 @@
104 def test_update_foreign_dhcp_ip_sets_value(self):
105 self.become_admin()
106 nodegroup = factory.make_node_group()
107- interface = nodegroup.get_managed_interface()
108+ [interface] = nodegroup.get_managed_interfaces()
109 ip = factory.getRandomIPAddress()
110 response = self.client_put(
111 reverse(
112@@ -717,7 +717,7 @@
113 def test_update_foreign_dhcp_ip_unsets_value(self):
114 self.become_admin()
115 nodegroup = factory.make_node_group()
116- interface = nodegroup.get_managed_interface()
117+ [interface] = nodegroup.get_managed_interfaces()
118 interface.foreign_dhcp_ip = factory.getRandomIPAddress()
119 interface.save()
120 response = self.client_put(
121
122=== modified file 'src/maasserver/tests/test_dhcp.py'
123--- src/maasserver/tests/test_dhcp.py 2014-01-17 09:49:34 +0000
124+++ src/maasserver/tests/test_dhcp.py 2014-01-27 12:53:33 +0000
125@@ -93,7 +93,7 @@
126 'ip_range_high',
127 ]
128
129- interface = nodegroup.get_managed_interface()
130+ [interface] = nodegroup.get_managed_interfaces()
131 expected_params = {
132 param: getattr(interface, param)
133 for param in dhcp_params}
134@@ -185,7 +185,7 @@
135
136 def test_dhcp_config_gets_written_when_nodegroupinterface_changes(self):
137 nodegroup = factory.make_node_group(status=NODEGROUP_STATUS.ACCEPTED)
138- interface = nodegroup.get_managed_interface()
139+ [interface] = nodegroup.get_managed_interfaces()
140 self.patch(settings, "DHCP_CONNECT", True)
141 self.patch(dhcp, 'write_dhcp_config')
142 get_ip_in_network = partial(
143
144=== modified file 'src/maasserver/tests/test_forms.py'
145--- src/maasserver/tests/test_forms.py 2014-01-23 11:59:37 +0000
146+++ src/maasserver/tests/test_forms.py 2014-01-27 12:53:33 +0000
147@@ -940,7 +940,7 @@
148
149 def test_accepts_name_change_if_nodes_in_use_but_dns_not_managed(self):
150 nodegroup, node = factory.make_unrenamable_nodegroup_with_node()
151- interface = nodegroup.get_managed_interface()
152+ [interface] = nodegroup.get_managed_interfaces()
153 interface.management = NODEGROUPINTERFACE_MANAGEMENT.DHCP
154 interface.save()
155 data = self.make_form_data(nodegroup)
156
157=== modified file 'src/maasserver/utils/tests/test_utils.py'
158--- src/maasserver/utils/tests/test_utils.py 2013-10-18 09:54:17 +0000
159+++ src/maasserver/utils/tests/test_utils.py 2014-01-27 12:53:33 +0000
160@@ -1,4 +1,4 @@
161-# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
162+# Copyright 2012-2014 Canonical Ltd. This software is licensed under the
163 # GNU Affero General Public License version 3 (see the file LICENSE).
164
165 """Tests for miscellaneous helpers."""
166@@ -221,10 +221,10 @@
167
168 def test_find_nodegroup_looks_up_nodegroup_by_controller_ip(self):
169 nodegroup = factory.make_node_group()
170- ip = nodegroup.get_managed_interface().ip
171+ [interface] = nodegroup.get_managed_interfaces()
172 self.assertEqual(
173 nodegroup,
174- find_nodegroup(get_request(ip)))
175+ find_nodegroup(get_request(interface.ip)))
176
177 def test_find_nodegroup_returns_None_if_not_found(self):
178 self.assertIsNone(