bb836b
From 472c2b5d4342b6ab6ce1584dc39bed0e6c1ca2e7 Mon Sep 17 00:00:00 2001
2b0ae0
From: Eduardo Otubo <otubo@redhat.com>
bb836b
Date: Fri, 7 May 2021 13:36:06 +0200
18322d
Subject: Do not write NM_CONTROLLED=no in generated interface config  files
18322d
2b0ae0
Conflicts 20.3:
2b0ae0
 - Not appplying patch on cloudinit/net/sysconfig.py since it now has a
2b0ae0
mechanism to identify if cloud-init is running on RHEL, having the
2b0ae0
correct settings for NM_CONTROLLED.
2b0ae0
18322d
X-downstream-only: true
2b0ae0
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
18322d
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
18322d
---
2b0ae0
 cloudinit/net/sysconfig.py  |  2 +-
bb836b
 tests/unittests/test_net.py | 28 ----------------------------
bb836b
 2 files changed, 1 insertion(+), 29 deletions(-)
18322d
18322d
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
bb836b
index 99a4bae4..3d276666 100644
18322d
--- a/cloudinit/net/sysconfig.py
18322d
+++ b/cloudinit/net/sysconfig.py
bb836b
@@ -289,7 +289,7 @@ class Renderer(renderer.Renderer):
2b0ae0
     #                                         details about this)
2b0ae0
 
2b0ae0
     iface_defaults = {
2b0ae0
-        'rhel': {'ONBOOT': True, 'USERCTL': False, 'NM_CONTROLLED': False,
2b0ae0
+        'rhel': {'ONBOOT': True, 'USERCTL': False,
2b0ae0
                  'BOOTPROTO': 'none'},
2b0ae0
         'suse': {'BOOTPROTO': 'static', 'STARTMODE': 'auto'},
2b0ae0
     }
18322d
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
bb836b
index 38d934d4..c67b5fcc 100644
18322d
--- a/tests/unittests/test_net.py
18322d
+++ b/tests/unittests/test_net.py
2b0ae0
@@ -535,7 +535,6 @@ GATEWAY=172.19.3.254
18322d
 HWADDR=fa:16:3e:ed:9a:59
18322d
 IPADDR=172.19.1.34
18322d
 NETMASK=255.255.252.0
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
2b0ae0
@@ -633,7 +632,6 @@ IPADDR=172.19.1.34
18322d
 IPADDR1=10.0.0.10
18322d
 NETMASK=255.255.252.0
18322d
 NETMASK1=255.255.255.0
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
bb836b
@@ -756,7 +754,6 @@ IPV6_AUTOCONF=no
18322d
 IPV6_DEFAULTGW=2001:DB8::1
bb836b
 IPV6_FORCE_ACCEPT_RA=no
18322d
 NETMASK=255.255.252.0
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
bb836b
@@ -884,7 +881,6 @@ NETWORK_CONFIGS = {
18322d
                 BOOTPROTO=none
18322d
                 DEVICE=eth1
18322d
                 HWADDR=cf:d6:af:48:e8:80
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -901,7 +897,6 @@ NETWORK_CONFIGS = {
18322d
                 IPADDR=192.168.21.3
18322d
                 NETMASK=255.255.255.0
18322d
                 METRIC=10000
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -1032,7 +1027,6 @@ NETWORK_CONFIGS = {
bb836b
                 IPV6_AUTOCONF=no
bb836b
                 IPV6_FORCE_ACCEPT_RA=no
18322d
                 NETMASK=255.255.255.0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no
bb836b
@@ -1737,7 +1731,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 DHCPV6C=yes
18322d
                 IPV6INIT=yes
18322d
                 MACADDR=aa:bb:cc:dd:ee:ff
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Bond
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -1745,7 +1738,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 BOOTPROTO=dhcp
18322d
                 DEVICE=bond0.200
8a7340
                 DHCLIENT_SET_DEFAULT_ROUTE=no
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 PHYSDEV=bond0
bb836b
                 USERCTL=no
bb836b
@@ -1763,7 +1755,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 IPV6_DEFAULTGW=2001:4800:78ff:1b::1
18322d
                 MACADDR=bb:bb:bb:bb:bb:aa
18322d
                 NETMASK=255.255.255.0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 PRIO=22
2b0ae0
                 STP=no
bb836b
@@ -1773,7 +1764,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 BOOTPROTO=none
18322d
                 DEVICE=eth0
18322d
                 HWADDR=c0:d6:9f:2c:e8:80
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -1790,7 +1780,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 MTU=1500
18322d
                 NETMASK=255.255.255.0
18322d
                 NETMASK1=255.255.255.0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 PHYSDEV=eth0
bb836b
                 USERCTL=no
bb836b
@@ -1800,7 +1789,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 DEVICE=eth1
18322d
                 HWADDR=aa:d6:9f:2c:e8:80
18322d
                 MASTER=bond0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 SLAVE=yes
2b0ae0
                 TYPE=Ethernet
bb836b
@@ -1810,7 +1798,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 DEVICE=eth2
18322d
                 HWADDR=c0:bb:9f:2c:e8:80
18322d
                 MASTER=bond0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 SLAVE=yes
2b0ae0
                 TYPE=Ethernet
bb836b
@@ -1820,7 +1807,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 BRIDGE=br0
18322d
                 DEVICE=eth3
18322d
                 HWADDR=66:bb:9f:2c:e8:80
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -1829,7 +1815,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 BRIDGE=br0
18322d
                 DEVICE=eth4
18322d
                 HWADDR=98:bb:9f:2c:e8:80
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -1838,7 +1823,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
18322d
                 DEVICE=eth5
8a7340
                 DHCLIENT_SET_DEFAULT_ROUTE=no
18322d
                 HWADDR=98:bb:9f:2c:e8:8a
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=no
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -2294,7 +2278,6 @@ iface bond0 inet6 static
18322d
         MTU=9000
18322d
         NETMASK=255.255.255.0
18322d
         NETMASK1=255.255.255.0
18322d
-        NM_CONTROLLED=no
18322d
         ONBOOT=yes
18322d
         TYPE=Bond
2b0ae0
         USERCTL=no
bb836b
@@ -2304,7 +2287,6 @@ iface bond0 inet6 static
18322d
         DEVICE=bond0s0
18322d
         HWADDR=aa:bb:cc:dd:e8:00
18322d
         MASTER=bond0
18322d
-        NM_CONTROLLED=no
18322d
         ONBOOT=yes
18322d
         SLAVE=yes
2b0ae0
         TYPE=Ethernet
bb836b
@@ -2326,7 +2308,6 @@ iface bond0 inet6 static
18322d
         DEVICE=bond0s1
18322d
         HWADDR=aa:bb:cc:dd:e8:01
18322d
         MASTER=bond0
18322d
-        NM_CONTROLLED=no
18322d
         ONBOOT=yes
18322d
         SLAVE=yes
2b0ae0
         TYPE=Ethernet
bb836b
@@ -2383,7 +2364,6 @@ iface bond0 inet6 static
18322d
                 BOOTPROTO=none
18322d
                 DEVICE=en0
18322d
                 HWADDR=aa:bb:cc:dd:e8:00
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no"""),
bb836b
@@ -2402,7 +2382,6 @@ iface bond0 inet6 static
18322d
                 MTU=2222
18322d
                 NETMASK=255.255.255.0
18322d
                 NETMASK1=255.255.255.0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 PHYSDEV=en0
bb836b
                 USERCTL=no
bb836b
@@ -2467,7 +2446,6 @@ iface bond0 inet6 static
18322d
                 DEVICE=br0
18322d
                 IPADDR=192.168.2.2
18322d
                 NETMASK=255.255.255.0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 PRIO=22
2b0ae0
                 STP=no
bb836b
@@ -2591,7 +2569,6 @@ iface bond0 inet6 static
18322d
                 HWADDR=52:54:00:12:34:00
18322d
                 IPADDR=192.168.1.2
18322d
                 NETMASK=255.255.255.0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=no
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no
bb836b
@@ -2601,7 +2578,6 @@ iface bond0 inet6 static
18322d
                 DEVICE=eth1
18322d
                 HWADDR=52:54:00:12:34:aa
18322d
                 MTU=1480
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no
bb836b
@@ -2610,7 +2586,6 @@ iface bond0 inet6 static
18322d
                 BOOTPROTO=none
18322d
                 DEVICE=eth2
18322d
                 HWADDR=52:54:00:12:34:ff
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=no
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no
bb836b
@@ -3027,7 +3002,6 @@ class TestRhelSysConfigRendering(CiTestCase):
18322d
 BOOTPROTO=dhcp
18322d
 DEVICE=eth1000
8a7340
 HWADDR=07-1c-c6-75-a4-be
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
bb836b
@@ -3148,7 +3122,6 @@ GATEWAY=10.0.2.2
18322d
 HWADDR=52:54:00:12:34:00
18322d
 IPADDR=10.0.2.15
18322d
 NETMASK=255.255.255.0
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
bb836b
@@ -3218,7 +3191,6 @@ USERCTL=no
18322d
 #
18322d
 BOOTPROTO=dhcp
18322d
 DEVICE=eth0
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
18322d
-- 
bb836b
2.27.0
18322d