Merge lp:~blake-rouse/maas/fix-1597324-2.0 into lp:maas/2.0

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 5140
Proposed branch: lp:~blake-rouse/maas/fix-1597324-2.0
Merge into: lp:maas/2.0
Diff against target: 39 lines (+17/-1)
2 files modified
src/maasserver/forms_interface_link.py (+4/-1)
src/maasserver/tests/test_forms_interface_link.py (+13/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1597324-2.0
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+298797@code.launchpad.net

Commit message

Allow selection of a DHCP link for the default gateway of a node.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Self-approving backport.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/forms_interface_link.py'
--- src/maasserver/forms_interface_link.py 2016-03-28 13:54:47 +0000
+++ src/maasserver/forms_interface_link.py 2016-06-30 15:22:24 +0000
@@ -228,7 +228,10 @@
228 """Return IP links on the instance that are of the correct type,228 """Return IP links on the instance that are of the correct type,
229 have a subnet, and has a gateway_ip set."""229 have a subnet, and has a gateway_ip set."""
230 links = self.instance.ip_addresses.filter(230 links = self.instance.ip_addresses.filter(
231 alloc_type__in=[IPADDRESS_TYPE.AUTO, IPADDRESS_TYPE.STICKY],231 alloc_type__in=[
232 IPADDRESS_TYPE.AUTO,
233 IPADDRESS_TYPE.STICKY,
234 IPADDRESS_TYPE.DHCP],
232 subnet__isnull=False, subnet__gateway_ip__isnull=False)235 subnet__isnull=False, subnet__gateway_ip__isnull=False)
233 links = links.select_related("subnet")236 links = links.select_related("subnet")
234 return [237 return [
235238
=== modified file 'src/maasserver/tests/test_forms_interface_link.py'
--- src/maasserver/tests/test_forms_interface_link.py 2016-03-28 13:54:47 +0000
+++ src/maasserver/tests/test_forms_interface_link.py 2016-06-30 15:22:24 +0000
@@ -563,6 +563,19 @@
563 ]563 ]
564 self.assertItemsEqual(link_ids, choice_ids)564 self.assertItemsEqual(link_ids, choice_ids)
565565
566 def test__sets_gateway_links_works_on_dhcp_with_gateway_ip(self):
567 interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL)
568 ipv4_link = self.make_ip_family_link(
569 interface, factory.make_ipv4_network(), IPADDRESS_TYPE.DHCP)
570 ipv6_link = self.make_ip_family_link(
571 interface, factory.make_ipv6_network(), IPADDRESS_TYPE.DHCP)
572 form = InterfaceSetDefaultGatwayForm(instance=interface, data={})
573 self.assertTrue(form.is_valid(), form.errors)
574 interface = form.save()
575 node = interface.get_node()
576 self.assertEqual(ipv4_link, node.gateway_link_ipv4)
577 self.assertEqual(ipv6_link, node.gateway_link_ipv6)
578
566 def test__sets_gateway_links_on_node_when_no_link_id(self):579 def test__sets_gateway_links_on_node_when_no_link_id(self):
567 interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL)580 interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL)
568 ipv4_link = self.make_ip_family_link(581 ipv4_link = self.make_ip_family_link(

Subscribers

People subscribed via source and target branches

to all changes: