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