2b0ae0
From d9024cd3bd3bf09b05eb75ba3d81bd15f519c9f8 Mon Sep 17 00:00:00 2001
2b0ae0
From: Eduardo Otubo <otubo@redhat.com>
2b0ae0
Date: Mon, 5 Oct 2020 13:49:46 +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 +-
18322d
 tests/unittests/test_net.py | 30 ------------------------------
2b0ae0
 2 files changed, 1 insertion(+), 31 deletions(-)
18322d
18322d
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
2b0ae0
index 0a5d481..23e467d 100644
18322d
--- a/cloudinit/net/sysconfig.py
18322d
+++ b/cloudinit/net/sysconfig.py
2b0ae0
@@ -277,7 +277,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
2b0ae0
index 54cc846..9985a97 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
2b0ae0
@@ -754,7 +752,6 @@ IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"
18322d
 IPV6INIT=yes
18322d
 IPV6_DEFAULTGW=2001:DB8::1
18322d
 NETMASK=255.255.252.0
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
2b0ae0
@@ -882,7 +879,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"""),
2b0ae0
@@ -899,7 +895,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"""),
2b0ae0
@@ -1028,7 +1023,6 @@ NETWORK_CONFIGS = {
18322d
                 IPV6ADDR=2001:1::1/64
18322d
                 IPV6INIT=yes
18322d
                 NETMASK=255.255.255.0
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no
2b0ae0
@@ -1622,7 +1616,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"""),
2b0ae0
@@ -1630,7 +1623,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
2b0ae0
                 TYPE=Ethernet
2b0ae0
@@ -1647,7 +1639,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
2b0ae0
@@ -1657,7 +1648,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"""),
2b0ae0
@@ -1674,7 +1664,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
2b0ae0
                 TYPE=Ethernet
2b0ae0
@@ -1685,7 +1674,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
2b0ae0
@@ -1695,7 +1683,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
2b0ae0
@@ -1705,7 +1692,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"""),
2b0ae0
@@ -1714,7 +1700,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"""),
2b0ae0
@@ -1723,7 +1708,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"""),
2b0ae0
@@ -2177,7 +2161,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
2b0ae0
@@ -2187,7 +2170,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
2b0ae0
@@ -2209,7 +2191,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
2b0ae0
@@ -2266,7 +2247,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"""),
2b0ae0
@@ -2283,7 +2263,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
2b0ae0
                 TYPE=Ethernet
2b0ae0
@@ -2349,7 +2328,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
2b0ae0
@@ -2363,7 +2341,6 @@ iface bond0 inet6 static
2b0ae0
                 HWADDR=52:54:00:12:34:00
18322d
                 IPV6ADDR=2001:1::100/96
18322d
                 IPV6INIT=yes
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no
2b0ae0
@@ -2375,7 +2352,6 @@ iface bond0 inet6 static
2b0ae0
                 HWADDR=52:54:00:12:34:01
18322d
                 IPV6ADDR=2001:1::101/96
18322d
                 IPV6INIT=yes
18322d
-                NM_CONTROLLED=no
18322d
                 ONBOOT=yes
18322d
                 TYPE=Ethernet
2b0ae0
                 USERCTL=no
2b0ae0
@@ -2469,7 +2445,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
2b0ae0
@@ -2479,7 +2454,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
2b0ae0
@@ -2488,7 +2462,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
2b0ae0
@@ -2905,7 +2878,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
2b0ae0
@@ -3026,7 +2998,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
2b0ae0
@@ -3096,7 +3067,6 @@ USERCTL=no
18322d
 #
18322d
 BOOTPROTO=dhcp
18322d
 DEVICE=eth0
18322d
-NM_CONTROLLED=no
18322d
 ONBOOT=yes
18322d
 TYPE=Ethernet
2b0ae0
 USERCTL=no
18322d
-- 
8a7340
1.8.3.1
18322d