ad9e5f
From e0dc628ac553072891fa6607dc91b652efd99be2 Mon Sep 17 00:00:00 2001
ea00c4
From: Eduardo Otubo <otubo@redhat.com>
fc6e82
Date: Fri, 7 May 2021 13:36:06 +0200
c1c26e
Subject: Do not write NM_CONTROLLED=no in generated interface config  files
c1c26e
ea00c4
Conflicts 20.3:
ea00c4
 - Not appplying patch on cloudinit/net/sysconfig.py since it now has a
ea00c4
mechanism to identify if cloud-init is running on RHEL, having the
ea00c4
correct settings for NM_CONTROLLED.
ea00c4
c1c26e
X-downstream-only: true
ea00c4
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
c1c26e
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
c1c26e
---
ad9e5f
 cloudinit/net/sysconfig.py  |  1 -
fc6e82
 tests/unittests/test_net.py | 28 ----------------------------
ad9e5f
 2 files changed, 29 deletions(-)
c1c26e
c1c26e
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
ad9e5f
index ba85c4f6..e06ddee7 100644
c1c26e
--- a/cloudinit/net/sysconfig.py
c1c26e
+++ b/cloudinit/net/sysconfig.py
ad9e5f
@@ -336,7 +336,6 @@ class Renderer(renderer.Renderer):
ad9e5f
         "rhel": {
ad9e5f
             "ONBOOT": True,
ad9e5f
             "USERCTL": False,
ad9e5f
-            "NM_CONTROLLED": False,
ad9e5f
             "BOOTPROTO": "none",
ad9e5f
         },
ad9e5f
         "suse": {"BOOTPROTO": "static", "STARTMODE": "auto"},
c1c26e
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
ad9e5f
index 47e4ba00..591241b3 100644
c1c26e
--- a/tests/unittests/test_net.py
c1c26e
+++ b/tests/unittests/test_net.py
ad9e5f
@@ -579,7 +579,6 @@ GATEWAY=172.19.3.254
c1c26e
 HWADDR=fa:16:3e:ed:9a:59
c1c26e
 IPADDR=172.19.1.34
c1c26e
 NETMASK=255.255.252.0
c1c26e
-NM_CONTROLLED=no
c1c26e
 ONBOOT=yes
c1c26e
 TYPE=Ethernet
ea00c4
 USERCTL=no
ad9e5f
@@ -712,7 +711,6 @@ IPADDR=172.19.1.34
c1c26e
 IPADDR1=10.0.0.10
c1c26e
 NETMASK=255.255.252.0
c1c26e
 NETMASK1=255.255.255.0
c1c26e
-NM_CONTROLLED=no
c1c26e
 ONBOOT=yes
c1c26e
 TYPE=Ethernet
ea00c4
 USERCTL=no
ad9e5f
@@ -874,7 +872,6 @@ IPV6_AUTOCONF=no
c1c26e
 IPV6_DEFAULTGW=2001:DB8::1
fc6e82
 IPV6_FORCE_ACCEPT_RA=no
c1c26e
 NETMASK=255.255.252.0
c1c26e
-NM_CONTROLLED=no
c1c26e
 ONBOOT=yes
c1c26e
 TYPE=Ethernet
ea00c4
 USERCTL=no
ad9e5f
@@ -1053,7 +1050,6 @@ NETWORK_CONFIGS = {
c1c26e
                 BOOTPROTO=none
c1c26e
                 DEVICE=eth1
c1c26e
                 HWADDR=cf:d6:af:48:e8:80
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -1072,7 +1068,6 @@ NETWORK_CONFIGS = {
c1c26e
                 IPADDR=192.168.21.3
c1c26e
                 NETMASK=255.255.255.0
c1c26e
                 METRIC=10000
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -1244,7 +1239,6 @@ NETWORK_CONFIGS = {
fc6e82
                 IPV6_AUTOCONF=no
fc6e82
                 IPV6_FORCE_ACCEPT_RA=no
c1c26e
                 NETMASK=255.255.255.0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ea00c4
                 USERCTL=no
ad9e5f
@@ -2093,7 +2087,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 DHCPV6C=yes
c1c26e
                 IPV6INIT=yes
c1c26e
                 MACADDR=aa:bb:cc:dd:ee:ff
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Bond
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -2103,7 +2096,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 BOOTPROTO=dhcp
c1c26e
                 DEVICE=bond0.200
16d12a
                 DHCLIENT_SET_DEFAULT_ROUTE=no
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 PHYSDEV=bond0
fc6e82
                 USERCTL=no
ad9e5f
@@ -2123,7 +2115,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 IPV6_DEFAULTGW=2001:4800:78ff:1b::1
c1c26e
                 MACADDR=bb:bb:bb:bb:bb:aa
c1c26e
                 NETMASK=255.255.255.0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 PRIO=22
ea00c4
                 STP=no
ad9e5f
@@ -2135,7 +2126,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 BOOTPROTO=none
c1c26e
                 DEVICE=eth0
c1c26e
                 HWADDR=c0:d6:9f:2c:e8:80
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -2154,7 +2144,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 MTU=1500
c1c26e
                 NETMASK=255.255.255.0
c1c26e
                 NETMASK1=255.255.255.0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 PHYSDEV=eth0
fc6e82
                 USERCTL=no
ad9e5f
@@ -2166,7 +2155,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 DEVICE=eth1
c1c26e
                 HWADDR=aa:d6:9f:2c:e8:80
c1c26e
                 MASTER=bond0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 SLAVE=yes
ea00c4
                 TYPE=Ethernet
ad9e5f
@@ -2178,7 +2166,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 DEVICE=eth2
c1c26e
                 HWADDR=c0:bb:9f:2c:e8:80
c1c26e
                 MASTER=bond0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 SLAVE=yes
ea00c4
                 TYPE=Ethernet
ad9e5f
@@ -2190,7 +2177,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 BRIDGE=br0
c1c26e
                 DEVICE=eth3
c1c26e
                 HWADDR=66:bb:9f:2c:e8:80
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -2201,7 +2187,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 BRIDGE=br0
c1c26e
                 DEVICE=eth4
c1c26e
                 HWADDR=98:bb:9f:2c:e8:80
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -2212,7 +2197,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
c1c26e
                 DEVICE=eth5
16d12a
                 DHCLIENT_SET_DEFAULT_ROUTE=no
c1c26e
                 HWADDR=98:bb:9f:2c:e8:8a
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=no
c1c26e
                 TYPE=Ethernet
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -2689,7 +2673,6 @@ iface bond0 inet6 static
c1c26e
         MTU=9000
c1c26e
         NETMASK=255.255.255.0
c1c26e
         NETMASK1=255.255.255.0
c1c26e
-        NM_CONTROLLED=no
c1c26e
         ONBOOT=yes
c1c26e
         TYPE=Bond
ea00c4
         USERCTL=no
ad9e5f
@@ -2701,7 +2684,6 @@ iface bond0 inet6 static
c1c26e
         DEVICE=bond0s0
c1c26e
         HWADDR=aa:bb:cc:dd:e8:00
c1c26e
         MASTER=bond0
c1c26e
-        NM_CONTROLLED=no
c1c26e
         ONBOOT=yes
c1c26e
         SLAVE=yes
ea00c4
         TYPE=Ethernet
ad9e5f
@@ -2729,7 +2711,6 @@ iface bond0 inet6 static
c1c26e
         DEVICE=bond0s1
c1c26e
         HWADDR=aa:bb:cc:dd:e8:01
c1c26e
         MASTER=bond0
c1c26e
-        NM_CONTROLLED=no
c1c26e
         ONBOOT=yes
c1c26e
         SLAVE=yes
ea00c4
         TYPE=Ethernet
ad9e5f
@@ -2794,7 +2775,6 @@ iface bond0 inet6 static
c1c26e
                 BOOTPROTO=none
c1c26e
                 DEVICE=en0
c1c26e
                 HWADDR=aa:bb:cc:dd:e8:00
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ad9e5f
                 USERCTL=no"""
ad9e5f
@@ -2815,7 +2795,6 @@ iface bond0 inet6 static
c1c26e
                 MTU=2222
c1c26e
                 NETMASK=255.255.255.0
c1c26e
                 NETMASK1=255.255.255.0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 PHYSDEV=en0
fc6e82
                 USERCTL=no
ad9e5f
@@ -2890,7 +2869,6 @@ iface bond0 inet6 static
c1c26e
                 DEVICE=br0
c1c26e
                 IPADDR=192.168.2.2
c1c26e
                 NETMASK=255.255.255.0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 PRIO=22
ea00c4
                 STP=no
ad9e5f
@@ -3032,7 +3010,6 @@ iface bond0 inet6 static
c1c26e
                 HWADDR=52:54:00:12:34:00
c1c26e
                 IPADDR=192.168.1.2
c1c26e
                 NETMASK=255.255.255.0
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=no
c1c26e
                 TYPE=Ethernet
ea00c4
                 USERCTL=no
ad9e5f
@@ -3044,7 +3021,6 @@ iface bond0 inet6 static
c1c26e
                 DEVICE=eth1
c1c26e
                 HWADDR=52:54:00:12:34:aa
c1c26e
                 MTU=1480
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=yes
c1c26e
                 TYPE=Ethernet
ea00c4
                 USERCTL=no
ad9e5f
@@ -3055,7 +3031,6 @@ iface bond0 inet6 static
c1c26e
                 BOOTPROTO=none
c1c26e
                 DEVICE=eth2
c1c26e
                 HWADDR=52:54:00:12:34:ff
c1c26e
-                NM_CONTROLLED=no
c1c26e
                 ONBOOT=no
c1c26e
                 TYPE=Ethernet
ea00c4
                 USERCTL=no
ad9e5f
@@ -3628,7 +3603,6 @@ class TestRhelSysConfigRendering(CiTestCase):
c1c26e
 BOOTPROTO=dhcp
c1c26e
 DEVICE=eth1000
16d12a
 HWADDR=07-1c-c6-75-a4-be
c1c26e
-NM_CONTROLLED=no
c1c26e
 ONBOOT=yes
c1c26e
 TYPE=Ethernet
ea00c4
 USERCTL=no
ad9e5f
@@ -3840,7 +3814,6 @@ GATEWAY=10.0.2.2
c1c26e
 HWADDR=52:54:00:12:34:00
c1c26e
 IPADDR=10.0.2.15
c1c26e
 NETMASK=255.255.255.0
c1c26e
-NM_CONTROLLED=no
c1c26e
 ONBOOT=yes
c1c26e
 TYPE=Ethernet
ea00c4
 USERCTL=no
ad9e5f
@@ -3910,7 +3883,6 @@ USERCTL=no
c1c26e
 #
c1c26e
 BOOTPROTO=dhcp
c1c26e
 DEVICE=eth0
c1c26e
-NM_CONTROLLED=no
c1c26e
 ONBOOT=yes
c1c26e
 TYPE=Ethernet
ea00c4
 USERCTL=no
c1c26e
-- 
ad9e5f
2.31.1
c1c26e