sailesh1993 / rpms / cloud-init

Forked from rpms/cloud-init a year ago
Clone
297660
From d9024cd3bd3bf09b05eb75ba3d81bd15f519c9f8 Mon Sep 17 00:00:00 2001
297660
From: Eduardo Otubo <otubo@redhat.com>
297660
Date: Mon, 5 Oct 2020 13:49:46 +0200
222d62
Subject: Do not write NM_CONTROLLED=no in generated interface config  files
222d62
297660
Conflicts 20.3:
297660
 - Not appplying patch on cloudinit/net/sysconfig.py since it now has a
297660
mechanism to identify if cloud-init is running on RHEL, having the
297660
correct settings for NM_CONTROLLED.
297660
222d62
X-downstream-only: true
297660
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
222d62
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
222d62
---
297660
 cloudinit/net/sysconfig.py  |  2 +-
0a07cd
 tests/unittests/test_net.py | 30 ------------------------------
297660
 2 files changed, 1 insertion(+), 31 deletions(-)
222d62
222d62
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
297660
index 0a5d481..23e467d 100644
222d62
--- a/cloudinit/net/sysconfig.py
222d62
+++ b/cloudinit/net/sysconfig.py
297660
@@ -277,7 +277,7 @@ class Renderer(renderer.Renderer):
297660
     #                                         details about this)
297660
 
297660
     iface_defaults = {
297660
-        'rhel': {'ONBOOT': True, 'USERCTL': False, 'NM_CONTROLLED': False,
297660
+        'rhel': {'ONBOOT': True, 'USERCTL': False,
297660
                  'BOOTPROTO': 'none'},
297660
         'suse': {'BOOTPROTO': 'static', 'STARTMODE': 'auto'},
297660
     }
222d62
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
297660
index 54cc846..9985a97 100644
222d62
--- a/tests/unittests/test_net.py
222d62
+++ b/tests/unittests/test_net.py
297660
@@ -535,7 +535,6 @@ GATEWAY=172.19.3.254
222d62
 HWADDR=fa:16:3e:ed:9a:59
222d62
 IPADDR=172.19.1.34
222d62
 NETMASK=255.255.252.0
222d62
-NM_CONTROLLED=no
222d62
 ONBOOT=yes
222d62
 TYPE=Ethernet
297660
 USERCTL=no
297660
@@ -633,7 +632,6 @@ IPADDR=172.19.1.34
222d62
 IPADDR1=10.0.0.10
222d62
 NETMASK=255.255.252.0
222d62
 NETMASK1=255.255.255.0
222d62
-NM_CONTROLLED=no
222d62
 ONBOOT=yes
222d62
 TYPE=Ethernet
297660
 USERCTL=no
297660
@@ -754,7 +752,6 @@ IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"
222d62
 IPV6INIT=yes
222d62
 IPV6_DEFAULTGW=2001:DB8::1
222d62
 NETMASK=255.255.252.0
222d62
-NM_CONTROLLED=no
222d62
 ONBOOT=yes
222d62
 TYPE=Ethernet
297660
 USERCTL=no
297660
@@ -882,7 +879,6 @@ NETWORK_CONFIGS = {
222d62
                 BOOTPROTO=none
222d62
                 DEVICE=eth1
222d62
                 HWADDR=cf:d6:af:48:e8:80
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no"""),
297660
@@ -899,7 +895,6 @@ NETWORK_CONFIGS = {
222d62
                 IPADDR=192.168.21.3
222d62
                 NETMASK=255.255.255.0
0a07cd
                 METRIC=10000
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no"""),
297660
@@ -1028,7 +1023,6 @@ NETWORK_CONFIGS = {
222d62
                 IPV6ADDR=2001:1::1/64
222d62
                 IPV6INIT=yes
222d62
                 NETMASK=255.255.255.0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no
297660
@@ -1622,7 +1616,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 DHCPV6C=yes
222d62
                 IPV6INIT=yes
222d62
                 MACADDR=aa:bb:cc:dd:ee:ff
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Bond
297660
                 USERCTL=no"""),
297660
@@ -1630,7 +1623,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 BOOTPROTO=dhcp
222d62
                 DEVICE=bond0.200
9dab26
                 DHCLIENT_SET_DEFAULT_ROUTE=no
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 PHYSDEV=bond0
297660
                 TYPE=Ethernet
297660
@@ -1647,7 +1639,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 IPV6_DEFAULTGW=2001:4800:78ff:1b::1
0a07cd
                 MACADDR=bb:bb:bb:bb:bb:aa
222d62
                 NETMASK=255.255.255.0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 PRIO=22
297660
                 STP=no
297660
@@ -1657,7 +1648,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 BOOTPROTO=none
222d62
                 DEVICE=eth0
222d62
                 HWADDR=c0:d6:9f:2c:e8:80
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no"""),
297660
@@ -1674,7 +1664,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 MTU=1500
222d62
                 NETMASK=255.255.255.0
222d62
                 NETMASK1=255.255.255.0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 PHYSDEV=eth0
297660
                 TYPE=Ethernet
297660
@@ -1685,7 +1674,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 DEVICE=eth1
222d62
                 HWADDR=aa:d6:9f:2c:e8:80
222d62
                 MASTER=bond0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 SLAVE=yes
297660
                 TYPE=Ethernet
297660
@@ -1695,7 +1683,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 DEVICE=eth2
222d62
                 HWADDR=c0:bb:9f:2c:e8:80
222d62
                 MASTER=bond0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 SLAVE=yes
297660
                 TYPE=Ethernet
297660
@@ -1705,7 +1692,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 BRIDGE=br0
222d62
                 DEVICE=eth3
222d62
                 HWADDR=66:bb:9f:2c:e8:80
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no"""),
297660
@@ -1714,7 +1700,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 BRIDGE=br0
222d62
                 DEVICE=eth4
222d62
                 HWADDR=98:bb:9f:2c:e8:80
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no"""),
297660
@@ -1723,7 +1708,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
222d62
                 DEVICE=eth5
9dab26
                 DHCLIENT_SET_DEFAULT_ROUTE=no
222d62
                 HWADDR=98:bb:9f:2c:e8:8a
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=no
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no"""),
297660
@@ -2177,7 +2161,6 @@ iface bond0 inet6 static
0a07cd
         MTU=9000
222d62
         NETMASK=255.255.255.0
222d62
         NETMASK1=255.255.255.0
222d62
-        NM_CONTROLLED=no
222d62
         ONBOOT=yes
222d62
         TYPE=Bond
297660
         USERCTL=no
297660
@@ -2187,7 +2170,6 @@ iface bond0 inet6 static
222d62
         DEVICE=bond0s0
222d62
         HWADDR=aa:bb:cc:dd:e8:00
222d62
         MASTER=bond0
222d62
-        NM_CONTROLLED=no
222d62
         ONBOOT=yes
222d62
         SLAVE=yes
297660
         TYPE=Ethernet
297660
@@ -2209,7 +2191,6 @@ iface bond0 inet6 static
222d62
         DEVICE=bond0s1
222d62
         HWADDR=aa:bb:cc:dd:e8:01
222d62
         MASTER=bond0
222d62
-        NM_CONTROLLED=no
222d62
         ONBOOT=yes
222d62
         SLAVE=yes
297660
         TYPE=Ethernet
297660
@@ -2266,7 +2247,6 @@ iface bond0 inet6 static
222d62
                 BOOTPROTO=none
222d62
                 DEVICE=en0
222d62
                 HWADDR=aa:bb:cc:dd:e8:00
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no"""),
297660
@@ -2283,7 +2263,6 @@ iface bond0 inet6 static
0a07cd
                 MTU=2222
222d62
                 NETMASK=255.255.255.0
222d62
                 NETMASK1=255.255.255.0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 PHYSDEV=en0
297660
                 TYPE=Ethernet
297660
@@ -2349,7 +2328,6 @@ iface bond0 inet6 static
222d62
                 DEVICE=br0
222d62
                 IPADDR=192.168.2.2
222d62
                 NETMASK=255.255.255.0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 PRIO=22
297660
                 STP=no
297660
@@ -2363,7 +2341,6 @@ iface bond0 inet6 static
297660
                 HWADDR=52:54:00:12:34:00
222d62
                 IPV6ADDR=2001:1::100/96
222d62
                 IPV6INIT=yes
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no
297660
@@ -2375,7 +2352,6 @@ iface bond0 inet6 static
297660
                 HWADDR=52:54:00:12:34:01
222d62
                 IPV6ADDR=2001:1::101/96
222d62
                 IPV6INIT=yes
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no
297660
@@ -2469,7 +2445,6 @@ iface bond0 inet6 static
222d62
                 HWADDR=52:54:00:12:34:00
222d62
                 IPADDR=192.168.1.2
222d62
                 NETMASK=255.255.255.0
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=no
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no
297660
@@ -2479,7 +2454,6 @@ iface bond0 inet6 static
222d62
                 DEVICE=eth1
222d62
                 HWADDR=52:54:00:12:34:aa
222d62
                 MTU=1480
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=yes
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no
297660
@@ -2488,7 +2462,6 @@ iface bond0 inet6 static
222d62
                 BOOTPROTO=none
222d62
                 DEVICE=eth2
222d62
                 HWADDR=52:54:00:12:34:ff
222d62
-                NM_CONTROLLED=no
222d62
                 ONBOOT=no
222d62
                 TYPE=Ethernet
297660
                 USERCTL=no
297660
@@ -2905,7 +2878,6 @@ class TestRhelSysConfigRendering(CiTestCase):
222d62
 BOOTPROTO=dhcp
222d62
 DEVICE=eth1000
9dab26
 HWADDR=07-1c-c6-75-a4-be
222d62
-NM_CONTROLLED=no
222d62
 ONBOOT=yes
222d62
 TYPE=Ethernet
297660
 USERCTL=no
297660
@@ -3026,7 +2998,6 @@ GATEWAY=10.0.2.2
222d62
 HWADDR=52:54:00:12:34:00
222d62
 IPADDR=10.0.2.15
222d62
 NETMASK=255.255.255.0
222d62
-NM_CONTROLLED=no
222d62
 ONBOOT=yes
222d62
 TYPE=Ethernet
297660
 USERCTL=no
297660
@@ -3096,7 +3067,6 @@ USERCTL=no
222d62
 #
222d62
 BOOTPROTO=dhcp
222d62
 DEVICE=eth0
222d62
-NM_CONTROLLED=no
222d62
 ONBOOT=yes
222d62
 TYPE=Ethernet
297660
 USERCTL=no
222d62
-- 
9dab26
1.8.3.1
222d62