297660
From 8a7d21fa739901bad847294004266dba76c027af Mon Sep 17 00:00:00 2001
297660
From: Eduardo Otubo <otubo@redhat.com>
297660
Date: Tue, 1 Dec 2020 15:51:47 +0100
297660
Subject: [PATCH 2/4] Adding BOOTPROTO = dhcp to render sysconfig dhcp6
297660
 stateful on RHEL (#685)
297660
297660
RH-Author: Eduardo Terrell Ferrari Otubo (eterrell)
297660
RH-MergeRequest: 25: Adding BOOTPROTO = dhcp to render sysconfig dhcp6 stateful on RHEL (#685)
297660
RH-Commit: [1/1] b7304323096b1e40287950e44cf7aa3cdb4ba99e (eterrell/cloud-init)
297660
RH-Bugzilla: 1859695
297660
297660
BOOTPROTO needs to be set to 'dhcp' on RHEL so NetworkManager can
297660
properly acquire ipv6 address.
297660
297660
rhbz: #1859695
297660
297660
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
297660
297660
Co-authored-by: Daniel Watkins <oddbloke@ubuntu.com>
297660
Co-authored-by: Scott Moser <smoser@brickies.net>
297660
---
297660
 cloudinit/net/sysconfig.py  | 6 ++++++
297660
 tests/unittests/test_net.py | 2 +-
297660
 2 files changed, 7 insertions(+), 1 deletion(-)
297660
297660
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
297660
index 078636a4..94801a93 100644
297660
--- a/cloudinit/net/sysconfig.py
297660
+++ b/cloudinit/net/sysconfig.py
297660
@@ -391,6 +391,12 @@ class Renderer(renderer.Renderer):
297660
                         # Only IPv6 is DHCP, IPv4 may be static
297660
                         iface_cfg['BOOTPROTO'] = 'dhcp6'
297660
                     iface_cfg['DHCLIENT6_MODE'] = 'managed'
297660
+                # only if rhel AND dhcpv6 stateful
297660
+                elif (flavor == 'rhel' and
297660
+                        subnet_type == 'ipv6_dhcpv6-stateful'):
297660
+                    iface_cfg['BOOTPROTO'] = 'dhcp'
297660
+                    iface_cfg['DHCPV6C'] = True
297660
+                    iface_cfg['IPV6INIT'] = True
297660
                 else:
297660
                     iface_cfg['IPV6INIT'] = True
297660
                     # Configure network settings using DHCPv6
297660
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
297660
index c0337459..bcd261db 100644
297660
--- a/tests/unittests/test_net.py
297660
+++ b/tests/unittests/test_net.py
297660
@@ -1359,7 +1359,7 @@ NETWORK_CONFIGS = {
297660
         },
297660
         'expected_sysconfig_rhel': {
297660
             'ifcfg-iface0': textwrap.dedent("""\
297660
-            BOOTPROTO=none
297660
+            BOOTPROTO=dhcp
297660
             DEVICE=iface0
297660
             DHCPV6C=yes
297660
             IPV6INIT=yes
297660
-- 
297660
2.18.4
297660