cloud-init/SOURCES/0003-Setting-autoconnect-pr...

583 lines
20 KiB
Diff
Raw Normal View History

2024-03-28 09:52:30 +00:00
From 8a2fcbbcfdfc1df6f6c18f96588154f40083a239 Mon Sep 17 00:00:00 2001
2023-09-21 18:10:28 +00:00
From: Ani Sinha <anisinha@redhat.com>
2024-03-28 09:52:30 +00:00
Date: Wed, 13 Dec 2023 11:55:16 +0530
Subject: [PATCH] Setting autoconnect priority setting for network-scripts
Squashed the following three downstream only commits from RHEL 9.3:
Commit 1:
Setting highest autoconnect priority for network-scripts
RH-Author: Eduardo Otubo <otubo@redhat.com>
RH-MergeRequest: 22: Setting highest autoconnect priority for network-scripts
RH-Commit: [1/1] 34f1d62f8934a983a124df95b861a1e448681d3b (otubo/cloud-init-src)
RH-Bugzilla: 2036060
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Set the highest autoconnect priority for network-scripts which is
loaded by NetworkManager ifcfg-rh plugin. Note that keyfile is the only
and default existing plugin on RHEL9, by setting the highest autoconnect
priority for network-scripts, NetworkManager will activate
network-scripts but keyfile. Network-scripts path:
Since this is a blocking issue, we decided to have this one-liner
downstream-only patch so we can move forward and have a better
NetworkManager support later on the release.
rhbz: 2036060
x-downstream-only: yes
Commit 2:
net/sysconfig: do not use the highest autoconnect priority
Using the highest priority is a very big hammer that we may not want to use. We
may want users to override the cloud init generated ifcfg files for custom
configuration of interfaces. If cloud init uses the highest priority, nothing
can beat it. Hence lower the priority to 120 allowing values from 121 to 999
to be used by users if they want to use a custom interface nm keyfile.
X-downstream-only: true
Suggested-by: thaller@redhat.com
fixes: c589da20eb92231 ("Setting highest autoconnect priority for network-scripts")
Commit 3:
test fixes: update tests to reflect AUTOCONNECT_PRIORITY setting
2023-09-21 18:10:28 +00:00
X-downstream-only: true
fixes: 0a2c6b6118ff ("net/sysconfig: do not use the highest autoconnect priority")
fixes: c589da20eb92 ("Setting highest autoconnect priority for network-scripts")
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
2024-03-28 09:52:30 +00:00
cloudinit/net/sysconfig.py | 1 +
2023-09-21 18:10:28 +00:00
tests/unittests/cmd/devel/test_net_convert.py | 1 +
tests/unittests/distros/test_netconfig.py | 8 +++
2024-03-28 09:52:30 +00:00
tests/unittests/test_net.py | 53 +++++++++++++++++++
4 files changed, 63 insertions(+)
2023-09-21 18:10:28 +00:00
2024-03-28 09:52:30 +00:00
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index f01c4236..d39f4fe3 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -318,6 +318,7 @@ class Renderer(renderer.Renderer):
"ONBOOT": True,
"USERCTL": False,
"BOOTPROTO": "none",
+ "AUTOCONNECT_PRIORITY": 120,
},
"suse": {"BOOTPROTO": "static", "STARTMODE": "auto"},
}
2023-09-21 18:10:28 +00:00
diff --git a/tests/unittests/cmd/devel/test_net_convert.py b/tests/unittests/cmd/devel/test_net_convert.py
2024-03-28 09:52:30 +00:00
index 7b9121b2..288e3e37 100644
2023-09-21 18:10:28 +00:00
--- a/tests/unittests/cmd/devel/test_net_convert.py
+++ b/tests/unittests/cmd/devel/test_net_convert.py
@@ -60,6 +60,7 @@ DHCP=ipv4
SAMPLE_SYSCONFIG_CONTENT = """\
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eth0
2024-03-28 09:52:30 +00:00
ONBOOT=yes
2023-09-21 18:10:28 +00:00
diff --git a/tests/unittests/distros/test_netconfig.py b/tests/unittests/distros/test_netconfig.py
2024-03-28 09:52:30 +00:00
index 962ff7fb..4c624079 100644
2023-09-21 18:10:28 +00:00
--- a/tests/unittests/distros/test_netconfig.py
+++ b/tests/unittests/distros/test_netconfig.py
@@ -717,6 +717,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
expected_cfgs = {
self.ifcfg_path("eth0"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
2024-03-28 09:52:30 +00:00
@@ -730,6 +731,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
2023-09-21 18:10:28 +00:00
),
self.ifcfg_path("eth1"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eth1
2024-03-28 09:52:30 +00:00
ONBOOT=yes
@@ -754,6 +756,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
2023-09-21 18:10:28 +00:00
expected_cfgs = {
self.ifcfg_path("eth0"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
2024-03-28 09:52:30 +00:00
@@ -769,6 +772,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
2023-09-21 18:10:28 +00:00
),
self.ifcfg_path("eth1"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eth1
2024-03-28 09:52:30 +00:00
ONBOOT=yes
@@ -812,6 +816,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
2023-09-21 18:10:28 +00:00
expected_cfgs = {
self.ifcfg_path("eth0"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth0
HWADDR=00:16:3e:60:7c:df
2024-03-28 09:52:30 +00:00
@@ -824,6 +829,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
2023-09-21 18:10:28 +00:00
),
self.ifcfg_path("infra0"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=infra0
IPADDR=10.0.1.2
2024-03-28 09:52:30 +00:00
@@ -859,6 +865,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
2023-09-21 18:10:28 +00:00
expected_cfgs = {
self.ifcfg_path("eth0"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth0
IPADDR=192.10.1.2
2024-03-28 09:52:30 +00:00
@@ -870,6 +877,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
2023-09-21 18:10:28 +00:00
),
self.ifcfg_path("eth0.1001"): dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth0.1001
IPADDR=10.0.1.2
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
2024-03-28 09:52:30 +00:00
index 052b0674..cef4fa2d 100644
2023-09-21 18:10:28 +00:00
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -578,6 +578,7 @@ dns = none
"""
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
@@ -740,6 +741,7 @@ dns = none
"""
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
@@ -897,6 +899,7 @@ dns = none
"""
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
2024-03-28 09:52:30 +00:00
@@ -1137,6 +1140,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-eth1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth1
HWADDR=cf:d6:af:48:e8:80
2024-03-28 09:52:30 +00:00
@@ -1146,6 +1150,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth99": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEFROUTE=yes
DEVICE=eth99
2024-03-28 09:52:30 +00:00
@@ -1311,6 +1316,7 @@ NETWORK_CONFIGS = {
"expected_sysconfig_rhel": {
"ifcfg-eth1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth1
HWADDR=cf:d6:af:48:e8:80
@@ -1320,6 +1326,7 @@ NETWORK_CONFIGS = {
),
"ifcfg-eth99": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEFROUTE=yes
DEVICE=eth99
@@ -1566,6 +1573,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=iface0
IPADDR=192.168.14.2
2024-03-28 09:52:30 +00:00
@@ -1712,6 +1720,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=iface0
DHCPV6C=yes
2024-03-28 09:52:30 +00:00
@@ -1801,6 +1810,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=iface0
DHCPV6C=yes
2024-03-28 09:52:30 +00:00
@@ -1876,6 +1886,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=iface0
DHCPV6C=yes
2024-03-28 09:52:30 +00:00
@@ -1940,6 +1951,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=iface0
IPV6_AUTOCONF=yes
2024-03-28 09:52:30 +00:00
@@ -1995,6 +2007,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=iface0
IPV6ADDR=2001:1::1/64
2024-03-28 09:52:30 +00:00
@@ -2051,6 +2064,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=iface0
DHCPV6C=yes
2024-03-28 09:52:30 +00:00
@@ -2135,6 +2149,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
2024-03-28 09:52:30 +00:00
BOOTPROTO=none
2023-09-21 18:10:28 +00:00
DEVICE=iface0
DHCPV6C=yes
2024-03-28 09:52:30 +00:00
@@ -2181,6 +2196,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=iface0
2024-03-28 09:52:30 +00:00
ONBOOT=yes
@@ -2256,6 +2272,7 @@ NETWORK_CONFIGS = {
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-iface0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=iface0
ETHTOOL_OPTS="wol g"
2024-03-28 09:52:30 +00:00
@@ -2591,6 +2608,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-bond0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BONDING_MASTER=yes
BONDING_OPTS="mode=active-backup """
"""xmit_hash_policy=layer3+4 """
2024-03-28 09:52:30 +00:00
@@ -2608,6 +2626,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-bond0.200": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=bond0.200
DHCLIENT_SET_DEFAULT_ROUTE=no
2024-03-28 09:52:30 +00:00
@@ -2619,6 +2638,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
"ifcfg-br0": textwrap.dedent(
"""\
AGEING=250
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=br0
2024-03-28 09:52:30 +00:00
@@ -2638,6 +2658,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth0
HWADDR=c0:d6:9f:2c:e8:80
2024-03-28 09:52:30 +00:00
@@ -2647,6 +2668,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth0.101": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0.101
2024-03-28 09:52:30 +00:00
@@ -2666,6 +2688,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth1
HWADDR=aa:d6:9f:2c:e8:80
2024-03-28 09:52:30 +00:00
@@ -2677,6 +2700,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth2": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth2
HWADDR=c0:bb:9f:2c:e8:80
2024-03-28 09:52:30 +00:00
@@ -2688,6 +2712,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth3": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
BRIDGE=br0
DEVICE=eth3
2024-03-28 09:52:30 +00:00
@@ -2698,6 +2723,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth4": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
BRIDGE=br0
DEVICE=eth4
2024-03-28 09:52:30 +00:00
@@ -2708,6 +2734,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth5": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eth5
DHCLIENT_SET_DEFAULT_ROUTE=no
2024-03-28 09:52:30 +00:00
@@ -2718,6 +2745,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
2023-09-21 18:10:28 +00:00
),
"ifcfg-ib0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=ib0
HWADDR=a0:00:02:20:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:15:e2:c1
2024-03-28 09:52:30 +00:00
@@ -3422,6 +3450,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-bond0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BONDING_MASTER=yes
BONDING_OPTS="mode=active-backup xmit_hash_policy=layer3+4 """
"""miimon=100 num_grat_arp=5 """
2024-03-28 09:52:30 +00:00
@@ -3452,6 +3481,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
),
"ifcfg-bond0s0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=bond0s0
HWADDR=aa:bb:cc:dd:e8:00
2024-03-28 09:52:30 +00:00
@@ -3479,6 +3509,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
),
"ifcfg-bond0s1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=bond0s1
HWADDR=aa:bb:cc:dd:e8:01
2024-03-28 09:52:30 +00:00
@@ -3628,6 +3659,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-en0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=en0
HWADDR=aa:bb:cc:dd:e8:00
2024-03-28 09:52:30 +00:00
@@ -3637,6 +3669,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
),
"ifcfg-en0.99": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=en0.99
2024-03-28 09:52:30 +00:00
@@ -3774,6 +3807,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-br0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=br0
IPADDR=192.168.2.2
2024-03-28 09:52:30 +00:00
@@ -3787,6 +3821,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
BRIDGE=br0
DEVICE=eth0
2024-03-28 09:52:30 +00:00
@@ -3802,6 +3837,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
BRIDGE=br0
DEVICE=eth1
2024-03-28 09:52:30 +00:00
@@ -3989,6 +4025,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-eth0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth0
HWADDR=52:54:00:12:34:00
2024-03-28 09:52:30 +00:00
@@ -4001,6 +4038,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth1
HWADDR=52:54:00:12:34:aa
2024-03-28 09:52:30 +00:00
@@ -4012,6 +4050,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
),
"ifcfg-eth2": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth2
HWADDR=52:54:00:12:34:ff
2024-03-28 09:52:30 +00:00
@@ -4096,6 +4135,7 @@ iface bond0 inet6 static
2023-09-21 18:10:28 +00:00
"expected_sysconfig_rhel": {
"ifcfg-eth0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eth0
HWADDR=cf:d6:af:48:e8:80
2024-03-28 09:52:30 +00:00
@@ -4693,6 +4733,7 @@ class TestRhelSysConfigRendering(CiTestCase):
2023-09-21 18:10:28 +00:00
expected_content = """
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eth1000
HWADDR=07-1c-c6-75-a4-be
2024-03-28 09:52:30 +00:00
@@ -4900,6 +4941,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
expected = """\
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=interface0
2024-03-28 09:52:30 +00:00
@@ -4929,6 +4971,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
expected_i1 = """\
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
2024-03-28 09:52:30 +00:00
@@ -4945,6 +4988,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
expected_i2 = """\
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eth1
DHCLIENT_SET_DEFAULT_ROUTE=no
2024-03-28 09:52:30 +00:00
@@ -4972,6 +5016,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
expected = """\
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eth0
ONBOOT=yes
2024-03-28 09:52:30 +00:00
@@ -5191,6 +5236,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
"expected_sysconfig": {
"ifcfg-ens3": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=ens3
2024-03-28 09:52:30 +00:00
@@ -5235,6 +5281,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
expected = {
"ifcfg-eno1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eno1
2024-03-28 09:52:30 +00:00
ONBOOT=yes
@@ -5244,6 +5291,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
),
"ifcfg-eno1.1000": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEVICE=eno1.1000
IPADDR=192.6.1.9
2024-03-28 09:52:30 +00:00
@@ -5276,6 +5324,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
expected = {
"ifcfg-bond0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BONDING_MASTER=yes
BONDING_SLAVE0=enp0s0
BONDING_SLAVE1=enp0s1
2024-03-28 09:52:30 +00:00
@@ -5291,6 +5340,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
),
"ifcfg-enp0s0": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BONDING_MASTER=yes
BOOTPROTO=none
DEVICE=enp0s0
2024-03-28 09:52:30 +00:00
@@ -5303,6 +5353,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
),
"ifcfg-enp0s1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BONDING_MASTER=yes
BOOTPROTO=none
DEVICE=enp0s1
2024-03-28 09:52:30 +00:00
@@ -5333,6 +5384,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
expected = {
"ifcfg-eno1": textwrap.dedent(
"""\
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=dhcp
DEVICE=eno1
HWADDR=07-1c-c6-75-a4-be
2024-03-28 09:52:30 +00:00
@@ -5411,6 +5463,7 @@ USERCTL=no
2023-09-21 18:10:28 +00:00
"""\
2024-03-28 09:52:30 +00:00
# Created by cloud-init automatically, do not edit.
2023-09-21 18:10:28 +00:00
#
+ AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0