← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~harald-jensas/cloud-init:bug/1848690 into cloud-init:master

 

Harald Jensås has proposed merging ~harald-jensas/cloud-init:bug/1848690 into cloud-init:master.

Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1848690 in cloud-init: "subnet_is_ipv6() function does not work for types ipv6_dhcpv6-stateless|stateful"
  https://bugs.launchpad.net/cloud-init/+bug/1848690

For more details, see:
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/374351
-- 
Your team cloud-init Commiters is requested to review the proposed merge of ~harald-jensas/cloud-init:bug/1848690 into cloud-init:master.
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index c0c415d..4ee323d 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -919,7 +919,7 @@ def is_ipv6_addr(address):
 def subnet_is_ipv6(subnet):
     """Common helper for checking network_state subnets for ipv6."""
     # 'static6' or 'dhcp6'
-    if subnet['type'].endswith('6'):
+    if subnet['type'].endswith('6') or subnet['type'].startswith('ipv6'):
         # This is a request for DHCPv6.
         return True
     elif subnet['type'] == 'static' and is_ipv6_addr(subnet.get('address')):
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index f5a9cae..adb53d0 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -4048,6 +4048,22 @@ class TestEniRoundTrip(CiTestCase):
             entry['expected_eni'].splitlines(),
             files['/etc/network/interfaces'].splitlines())
 
+    def testsimple_render_dhcpv6_stateless(self):
+        entry = NETWORK_CONFIGS['dhcpv6_stateless']
+        files = self._render_and_read(network_config=yaml.load(
+            entry['yaml']))
+        self.assertEqual(
+            entry['expected_eni'].splitlines(),
+            files['/etc/network/interfaces'].splitlines())
+
+    def testsimple_render_dhcpv6_stateful(self):
+        entry = NETWORK_CONFIGS['dhcpv6_stateless']
+        files = self._render_and_read(network_config=yaml.load(
+            entry['yaml']))
+        self.assertEqual(
+            entry['expected_eni'].splitlines(),
+            files['/etc/network/interfaces'].splitlines())
+
     def testsimple_render_manual(self):
         """Test rendering of 'manual' for 'type' and 'control'.
 

Follow ups