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

Proposed by Harald Jensås
Status: Merged
Approved by: Ryan Harper
Approved revision: 1608b91acdd9e07411c375a9421744e19d517de1
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~harald-jensas/cloud-init:bug/1848690
Merge into: cloud-init:master
Diff against target: 41 lines (+18/-2)
2 files modified
cloudinit/net/network_state.py (+2/-2)
tests/unittests/test_net.py (+16/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Review via email: mp+374351@code.launchpad.net

Commit message

net: fix subnet_is_ipv6() for stateless|stateful

Function return false for ipv6_dhcpv6-stateless|stateful,
the eni renderer does not add '6' to 'inet' which is
incorrect.

The subnet_is_ipv6() function is updated to also return
true if startswith('ipv6').

LP: #1848690

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) :
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/374351/+edit-commit-message
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1218/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1218//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

This passed CI fine, but seemed to vote needs fixing. Resubmitting.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:b8ddae4c096df113d1070f49e3e7fc4398066cb2
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1241/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1241//rebuild

review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
2index c0c415d..6c6eb74 100644
3--- a/cloudinit/net/network_state.py
4+++ b/cloudinit/net/network_state.py
5@@ -918,8 +918,8 @@ def is_ipv6_addr(address):
6
7 def subnet_is_ipv6(subnet):
8 """Common helper for checking network_state subnets for ipv6."""
9- # 'static6' or 'dhcp6'
10- if subnet['type'].endswith('6'):
11+ # 'static6', 'dhcp6', 'ipv6_dhcpv6-stateful' or 'ipv6_dhcpv6-stateless'
12+ if subnet['type'].endswith('6') or subnet['type'].startswith('ipv6'):
13 # This is a request for DHCPv6.
14 return True
15 elif subnet['type'] == 'static' and is_ipv6_addr(subnet.get('address')):
16diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
17index f5a9cae..adb53d0 100644
18--- a/tests/unittests/test_net.py
19+++ b/tests/unittests/test_net.py
20@@ -4048,6 +4048,22 @@ class TestEniRoundTrip(CiTestCase):
21 entry['expected_eni'].splitlines(),
22 files['/etc/network/interfaces'].splitlines())
23
24+ def testsimple_render_dhcpv6_stateless(self):
25+ entry = NETWORK_CONFIGS['dhcpv6_stateless']
26+ files = self._render_and_read(network_config=yaml.load(
27+ entry['yaml']))
28+ self.assertEqual(
29+ entry['expected_eni'].splitlines(),
30+ files['/etc/network/interfaces'].splitlines())
31+
32+ def testsimple_render_dhcpv6_stateful(self):
33+ entry = NETWORK_CONFIGS['dhcpv6_stateless']
34+ files = self._render_and_read(network_config=yaml.load(
35+ entry['yaml']))
36+ self.assertEqual(
37+ entry['expected_eni'].splitlines(),
38+ files['/etc/network/interfaces'].splitlines())
39+
40 def testsimple_render_manual(self):
41 """Test rendering of 'manual' for 'type' and 'control'.
42

Subscribers

People subscribed via source and target branches