From 1064b17095b3a38a9f96d635e3e720e10d31fb7868679a60ec9df6fa9d1cb1e0 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Fri, 18 Jan 2019 09:50:54 +0000 Subject: [PATCH 1/8] =?UTF-8?q?-=20Update=20to=20version=2018.5=20(bsc#112?= =?UTF-8?q?1878,=20boo#1116767)=20=20=20+=20Remove=20=20=20=20=200001-Fix-?= =?UTF-8?q?the-service-order-for-SUSE-distributions.patch=20=20=20=20=2000?= =?UTF-8?q?01-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch?= =?UTF-8?q?=20=20=20=20=200002-Add-tests-for-additional-openSUSE-distro-co?= =?UTF-8?q?ndition-m.patch=20=20=20=20=20included=20upstream=20=20=20+=20F?= =?UTF-8?q?orward=20port=20cloud-init-sysconf-ethsetup.patch=20=20=20+=20A?= =?UTF-8?q?dd=20cloud-init-write-routes.patch=20=20=20+=20tests:=20add=20D?= =?UTF-8?q?isco=20release=20[Joshua=20Powers]=20=20=20+=20net:=20render=20?= =?UTF-8?q?'metric'=20values=20in=20per-subnet=20routes=20(LP:=20#1805871)?= =?UTF-8?q?=20=20=20+=20write=5Ffiles:=20add=20support=20for=20appending?= =?UTF-8?q?=20to=20files.=20[James=20Baxter]=20=20=20+=20config:=20On=20ub?= =?UTF-8?q?untu=20select=20cloud=20archive=20mirrors=20for=20armel,=20armh?= =?UTF-8?q?f,=20arm64.=20=20=20=20=20(LP:=20#1805854)=20=20=20+=20dhclient?= =?UTF-8?q?-hook:=20cleanups,=20tests=20and=20fix=20a=20bug=20on=20'down'?= =?UTF-8?q?=20event.=20=20=20+=20NoCloud:=20Allow=20top=20level=20'network?= =?UTF-8?q?'=20key=20in=20network-config.=20(LP:=20#1798117)=20=20=20+=20o?= =?UTF-8?q?vf:=20Fix=20ovf=20network=20config=20generation=20gateway/route?= =?UTF-8?q?s=20(LP:=20#1806103)=20=20=20+=20azure:=20detect=20vnet=20migra?= =?UTF-8?q?tion=20via=20netlink=20media=20change=20event=20=20=20=20=20[Ta?= =?UTF-8?q?milmani=20Manoharan]=20=20=20+=20Azure:=20fix=20copy/paste=20er?= =?UTF-8?q?ror=20in=20error=20handling=20when=20reading=20azure=20ovf.=20?= =?UTF-8?q?=20=20+=20[Adam=20DePue]=20=20=20+=20tests:=20fix=20incorrect?= =?UTF-8?q?=20order=20of=20mocks=20in=20test=5Fhandle=5Fzfs=5Froot.=20=20?= =?UTF-8?q?=20+=20doc:=20Change=20dns=5Fnameserver=20property=20to=20dns?= =?UTF-8?q?=5Fnameservers.=20[Tomer=20Cohen]=20=20=20+=20OVF:=20identify?= =?UTF-8?q?=20label=20iso9660=20filesystems=20with=20label=20'OVF=20ENV'.?= =?UTF-8?q?=20=20=20+=20logs:=20collect-logs=20ignore=20instance-data-sens?= =?UTF-8?q?itive.json=20on=20non-root=20user=20=20=20=20=20(LP:=20#1805201?= =?UTF-8?q?)=20=20=20+=20net:=20Ephemeral*Network:=20add=20connectivity=20?= =?UTF-8?q?check=20via=20URL=20=20=20+=20azure:=20=5Fpoll=5Fimds=20only=20?= =?UTF-8?q?retry=20on=20404.=20Fail=20on=20Timeout=20(LP:=20#1803598)=20?= =?UTF-8?q?=20=20+=20resizefs:=20Prefix=20discovered=20devpath=20with=20'/?= =?UTF-8?q?dev/'=20when=20path=20does=20not=20=20=20=20=20exist=20[Igor=20?= =?UTF-8?q?Gali=C3=84=E2=80=A1]=20=20=20+=20azure:=20retry=20imds=20pollin?= =?UTF-8?q?g=20on=20requests.Timeout=20(LP:=20#1800223)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125 --- cloud-init-18.4.tar.gz | 3 - cloud-init-18.5.tar.gz | 3 + cloud-init-sysconf-ethsetup.patch | 159 +++++++++++++----------------- cloud-init-write-routes.patch | 40 ++++++++ cloud-init.changes | 64 ++++++++++++ cloud-init.spec | 18 ++-- 6 files changed, 182 insertions(+), 105 deletions(-) delete mode 100644 cloud-init-18.4.tar.gz create mode 100644 cloud-init-18.5.tar.gz create mode 100644 cloud-init-write-routes.patch diff --git a/cloud-init-18.4.tar.gz b/cloud-init-18.4.tar.gz deleted file mode 100644 index 796c19c..0000000 --- a/cloud-init-18.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f19b969dbf2bda771a6a41fdb22b79b163b8a3b81cf1a45036d17993789bef7f -size 965107 diff --git a/cloud-init-18.5.tar.gz b/cloud-init-18.5.tar.gz new file mode 100644 index 0000000..2d9d4fd --- /dev/null +++ b/cloud-init-18.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:650d1eb38ea488b3ea8cc9d7b0fb975bb3c9a3e5ca7dcaf924892f5f9813da92 +size 990381 diff --git a/cloud-init-sysconf-ethsetup.patch b/cloud-init-sysconf-ethsetup.patch index 03c7929..21f6b4f 100644 --- a/cloud-init-sysconf-ethsetup.patch +++ b/cloud-init-sysconf-ethsetup.patch @@ -1,20 +1,6 @@ -From 6732e10fa677566a2ddcbc7ff6727cf697d35761 Mon Sep 17 00:00:00 2001 -From: Robert Schweikert -Date: Tue, 23 Oct 2018 12:37:19 -0400 -Subject: [PATCH] - Follow up to db50bc0d9 + ONBOOT is not recognized on - openSUSE and SUSE Linux Enterprise, add the STARTMODE setting - ---- - cloudinit/net/sysconfig.py | 2 + - .../unittests/test_distros/test_netconfig.py | 8 ++++ - tests/unittests/test_net.py | 40 +++++++++++++++++++ - 3 files changed, 50 insertions(+) - -diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py -index 9c16d3a7..ff847038 100644 ---- a/cloudinit/net/sysconfig.py -+++ b/cloudinit/net/sysconfig.py -@@ -242,6 +242,7 @@ class Renderer(renderer.Renderer): +--- cloudinit/net/sysconfig.py.orig ++++ cloudinit/net/sysconfig.py +@@ -252,6 +252,7 @@ class Renderer(renderer.Renderer): ('USERCTL', False), ('NM_CONTROLLED', False), ('BOOTPROTO', 'none'), @@ -22,7 +8,7 @@ index 9c16d3a7..ff847038 100644 ]) # If these keys exist, then their values will be used to form -@@ -336,6 +337,7 @@ class Renderer(renderer.Renderer): +@@ -346,6 +347,7 @@ class Renderer(renderer.Renderer): iface_cfg.name)) if subnet.get('control') == 'manual': iface_cfg['ONBOOT'] = False @@ -30,11 +16,9 @@ index 9c16d3a7..ff847038 100644 # set IPv4 and IPv6 static addresses ipv4_index = -1 -diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py -index 6e339355..e986b593 100644 ---- a/tests/unittests/test_distros/test_netconfig.py -+++ b/tests/unittests/test_distros/test_netconfig.py -@@ -468,6 +468,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): +--- tests/unittests/test_distros/test_netconfig.py.orig ++++ tests/unittests/test_distros/test_netconfig.py +@@ -468,6 +468,7 @@ class TestNetCfgDistroRedhat(TestNetCfgD NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes @@ -42,7 +26,7 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -@@ -476,6 +477,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): +@@ -476,6 +477,7 @@ class TestNetCfgDistroRedhat(TestNetCfgD DEVICE=eth1 NM_CONTROLLED=no ONBOOT=yes @@ -50,7 +34,7 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -@@ -499,6 +501,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): +@@ -499,6 +501,7 @@ class TestNetCfgDistroRedhat(TestNetCfgD IPV6_DEFAULTGW=2607:f0d0:1002:0011::1 NM_CONTROLLED=no ONBOOT=yes @@ -58,7 +42,7 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -@@ -507,6 +510,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): +@@ -507,6 +510,7 @@ class TestNetCfgDistroRedhat(TestNetCfgD DEVICE=eth1 NM_CONTROLLED=no ONBOOT=yes @@ -66,7 +50,7 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -@@ -559,6 +563,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase): +@@ -559,6 +563,7 @@ class TestNetCfgDistroOpensuse(TestNetCf NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes @@ -74,7 +58,7 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -@@ -567,6 +572,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase): +@@ -567,6 +572,7 @@ class TestNetCfgDistroOpensuse(TestNetCf DEVICE=eth1 NM_CONTROLLED=no ONBOOT=yes @@ -82,7 +66,7 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -@@ -587,6 +593,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase): +@@ -587,6 +593,7 @@ class TestNetCfgDistroOpensuse(TestNetCf IPV6_DEFAULTGW=2607:f0d0:1002:0011::1 NM_CONTROLLED=no ONBOOT=yes @@ -90,7 +74,7 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -@@ -595,6 +602,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase): +@@ -595,6 +602,7 @@ class TestNetCfgDistroOpensuse(TestNetCf DEVICE=eth1 NM_CONTROLLED=no ONBOOT=yes @@ -98,10 +82,8 @@ index 6e339355..e986b593 100644 TYPE=Ethernet USERCTL=no """), -diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py -index 8e383739..d94b9430 100644 ---- a/tests/unittests/test_net.py -+++ b/tests/unittests/test_net.py +--- tests/unittests/test_net.py.orig ++++ tests/unittests/test_net.py @@ -144,6 +144,7 @@ IPADDR=172.19.1.34 NETMASK=255.255.252.0 NM_CONTROLLED=no @@ -150,7 +132,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """.lstrip()), -@@ -524,6 +530,7 @@ NETWORK_CONFIGS = { +@@ -525,6 +531,7 @@ NETWORK_CONFIGS = { HWADDR=cf:d6:af:48:e8:80 NM_CONTROLLED=no ONBOOT=yes @@ -158,15 +140,15 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no"""), 'ifcfg-eth99': textwrap.dedent("""\ -@@ -539,6 +546,7 @@ NETWORK_CONFIGS = { - NETMASK=255.255.255.0 +@@ -541,6 +548,7 @@ NETWORK_CONFIGS = { + METRIC=10000 NM_CONTROLLED=no ONBOOT=yes + STARTMODE=auto TYPE=Ethernet USERCTL=no"""), }, -@@ -652,6 +660,7 @@ NETWORK_CONFIGS = { +@@ -654,6 +662,7 @@ NETWORK_CONFIGS = { NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes @@ -174,7 +156,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no MTU=9000 -@@ -691,6 +700,7 @@ NETWORK_CONFIGS = { +@@ -693,6 +702,7 @@ NETWORK_CONFIGS = { DEVICE=iface0 NM_CONTROLLED=no ONBOOT=yes @@ -182,7 +164,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """), -@@ -894,6 +904,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -896,6 +906,7 @@ pre-down route del -net 10.0.0.0 netmask MACADDR=aa:bb:cc:dd:ee:ff NM_CONTROLLED=no ONBOOT=yes @@ -190,23 +172,23 @@ index 8e383739..d94b9430 100644 TYPE=Bond USERCTL=no"""), 'ifcfg-bond0.200': textwrap.dedent("""\ -@@ -902,6 +913,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -903,6 +914,7 @@ pre-down route del -net 10.0.0.0 netmask + DEVICE=bond0.200 NM_CONTROLLED=no ONBOOT=yes - PHYSDEV=bond0 + STARTMODE=auto + PHYSDEV=bond0 TYPE=Ethernet USERCTL=no - VLAN=yes"""), -@@ -919,6 +931,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -920,6 +932,7 @@ pre-down route del -net 10.0.0.0 netmask + NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes - PRIO=22 + STARTMODE=auto + PRIO=22 STP=no TYPE=Bridge - USERCTL=no"""), -@@ -928,6 +941,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -930,6 +943,7 @@ pre-down route del -net 10.0.0.0 netmask HWADDR=c0:d6:9f:2c:e8:80 NM_CONTROLLED=no ONBOOT=yes @@ -214,15 +196,15 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no"""), 'ifcfg-eth0.101': textwrap.dedent("""\ -@@ -946,6 +960,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -947,6 +961,7 @@ pre-down route del -net 10.0.0.0 netmask + NETMASK1=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes - PHYSDEV=eth0 + STARTMODE=auto + PHYSDEV=eth0 TYPE=Ethernet USERCTL=no - VLAN=yes"""), -@@ -956,6 +971,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -958,6 +973,7 @@ pre-down route del -net 10.0.0.0 netmask MASTER=bond0 NM_CONTROLLED=no ONBOOT=yes @@ -230,7 +212,7 @@ index 8e383739..d94b9430 100644 SLAVE=yes TYPE=Ethernet USERCTL=no"""), -@@ -966,6 +982,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -968,6 +984,7 @@ pre-down route del -net 10.0.0.0 netmask MASTER=bond0 NM_CONTROLLED=no ONBOOT=yes @@ -238,7 +220,7 @@ index 8e383739..d94b9430 100644 SLAVE=yes TYPE=Ethernet USERCTL=no"""), -@@ -976,6 +993,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -978,6 +995,7 @@ pre-down route del -net 10.0.0.0 netmask HWADDR=66:bb:9f:2c:e8:80 NM_CONTROLLED=no ONBOOT=yes @@ -246,7 +228,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no"""), 'ifcfg-eth4': textwrap.dedent("""\ -@@ -985,6 +1003,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -987,6 +1005,7 @@ pre-down route del -net 10.0.0.0 netmask HWADDR=98:bb:9f:2c:e8:80 NM_CONTROLLED=no ONBOOT=yes @@ -254,7 +236,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no"""), 'ifcfg-eth5': textwrap.dedent("""\ -@@ -993,6 +1012,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -995,6 +1014,7 @@ pre-down route del -net 10.0.0.0 netmask HWADDR=98:bb:9f:2c:e8:8a NM_CONTROLLED=no ONBOOT=no @@ -262,7 +244,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no""") }, -@@ -1282,6 +1302,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1306,6 +1326,7 @@ pre-down route del -net 10.0.0.0 netmask NETMASK1=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes @@ -270,23 +252,23 @@ index 8e383739..d94b9430 100644 TYPE=Bond USERCTL=no """), -@@ -1293,6 +1314,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1316,6 +1337,7 @@ pre-down route del -net 10.0.0.0 netmask + MASTER=bond0 NM_CONTROLLED=no ONBOOT=yes - SLAVE=yes + STARTMODE=auto + SLAVE=yes TYPE=Ethernet USERCTL=no - """), -@@ -1309,6 +1331,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1332,6 +1354,7 @@ pre-down route del -net 10.0.0.0 netmask + MASTER=bond0 NM_CONTROLLED=no ONBOOT=yes - SLAVE=yes + STARTMODE=auto + SLAVE=yes TYPE=Ethernet USERCTL=no - """), -@@ -1334,6 +1357,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1358,6 +1381,7 @@ pre-down route del -net 10.0.0.0 netmask NETMASK1=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes @@ -294,23 +276,23 @@ index 8e383739..d94b9430 100644 TYPE=Bond USERCTL=no """), -@@ -1345,6 +1369,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1368,6 +1392,7 @@ pre-down route del -net 10.0.0.0 netmask + MASTER=bond0 NM_CONTROLLED=no ONBOOT=yes - SLAVE=yes + STARTMODE=auto + SLAVE=yes TYPE=Ethernet USERCTL=no - """), -@@ -1363,6 +1388,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1390,6 +1415,7 @@ pre-down route del -net 10.0.0.0 netmask + MASTER=bond0 NM_CONTROLLED=no ONBOOT=yes - SLAVE=yes + STARTMODE=auto + SLAVE=yes TYPE=Ethernet USERCTL=no - """), -@@ -1400,6 +1426,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1428,6 +1454,7 @@ pre-down route del -net 10.0.0.0 netmask HWADDR=aa:bb:cc:dd:e8:00 NM_CONTROLLED=no ONBOOT=yes @@ -318,23 +300,23 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no"""), 'ifcfg-en0.99': textwrap.dedent("""\ -@@ -1418,6 +1445,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1445,6 +1472,7 @@ pre-down route del -net 10.0.0.0 netmask + NETMASK1=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes - PHYSDEV=en0 + STARTMODE=auto + PHYSDEV=en0 TYPE=Ethernet USERCTL=no - VLAN=yes"""), -@@ -1459,6 +1487,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1486,6 +1514,7 @@ pre-down route del -net 10.0.0.0 netmask + NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes - PRIO=22 + STARTMODE=auto + PRIO=22 STP=no TYPE=Bridge - USERCTL=no -@@ -1472,6 +1501,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1500,6 +1529,7 @@ pre-down route del -net 10.0.0.0 netmask IPV6INIT=yes NM_CONTROLLED=no ONBOOT=yes @@ -342,7 +324,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """), -@@ -1484,6 +1514,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1512,6 +1542,7 @@ pre-down route del -net 10.0.0.0 netmask IPV6INIT=yes NM_CONTROLLED=no ONBOOT=yes @@ -350,7 +332,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """), -@@ -1558,6 +1589,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1586,6 +1617,7 @@ pre-down route del -net 10.0.0.0 netmask NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=no @@ -358,7 +340,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """), -@@ -1568,6 +1600,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1596,6 +1628,7 @@ pre-down route del -net 10.0.0.0 netmask MTU=1480 NM_CONTROLLED=no ONBOOT=yes @@ -366,7 +348,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """), -@@ -1577,6 +1610,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true +@@ -1605,6 +1638,7 @@ pre-down route del -net 10.0.0.0 netmask HWADDR=52:54:00:12:34:ff NM_CONTROLLED=no ONBOOT=no @@ -374,7 +356,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """), -@@ -1933,6 +1967,7 @@ DEVICE=eth1000 +@@ -1971,6 +2005,7 @@ DEVICE=eth1000 HWADDR=07-1C-C6-75-A4-BE NM_CONTROLLED=no ONBOOT=yes @@ -382,7 +364,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """.lstrip() -@@ -2054,6 +2089,7 @@ IPADDR=10.0.2.15 +@@ -2092,6 +2127,7 @@ IPADDR=10.0.2.15 NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes @@ -390,7 +372,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """ -@@ -2075,6 +2111,7 @@ BOOTPROTO=dhcp +@@ -2113,6 +2149,7 @@ BOOTPROTO=dhcp DEVICE=eth0 NM_CONTROLLED=no ONBOOT=yes @@ -398,7 +380,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """ -@@ -2222,6 +2259,7 @@ DEVICE=eth1000 +@@ -2260,6 +2297,7 @@ DEVICE=eth1000 HWADDR=07-1C-C6-75-A4-BE NM_CONTROLLED=no ONBOOT=yes @@ -406,7 +388,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """.lstrip() -@@ -2343,6 +2381,7 @@ IPADDR=10.0.2.15 +@@ -2381,6 +2419,7 @@ IPADDR=10.0.2.15 NETMASK=255.255.255.0 NM_CONTROLLED=no ONBOOT=yes @@ -414,7 +396,7 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """ -@@ -2364,6 +2403,7 @@ BOOTPROTO=dhcp +@@ -2402,6 +2441,7 @@ BOOTPROTO=dhcp DEVICE=eth0 NM_CONTROLLED=no ONBOOT=yes @@ -422,6 +404,3 @@ index 8e383739..d94b9430 100644 TYPE=Ethernet USERCTL=no """ --- -2.19.0 - diff --git a/cloud-init-write-routes.patch b/cloud-init-write-routes.patch new file mode 100644 index 0000000..a86f8cd --- /dev/null +++ b/cloud-init-write-routes.patch @@ -0,0 +1,40 @@ +--- cloudinit/distros/opensuse.py.orig ++++ cloudinit/distros/opensuse.py +@@ -172,8 +172,37 @@ class Distro(distros.Distro): + util.write_file(out_fn, str(conf), 0o644) + + def _write_network_config(self, netconfig): ++ self._write_routes(netconfig) + return self._supported_write_network_config(netconfig) + ++ def _write_routes(self, netconfig): ++ """Write route files, not part of the standard distro interface""" ++ # Due to the implementation of the sysconfig renderer default routes ++ # are setup in ifcfg-* files. But this does not work on SLES or ++ # openSUSE https://bugs.launchpad.net/cloud-init/+bug/1812117 ++ # this is a very hacky way to get around the problem until a real ++ # solution is found in the sysconfig renderer ++ device_configs = netconfig.get('config', []) ++ default_nets = ('::', '0.0.0.0') ++ for config in device_configs: ++ if_name = config.get('name') ++ subnets = config.get('subnets', []) ++ for subnet in subnets: ++ routes = subnet.get('routes', []) ++ config_routes = '' ++ for route in routes: ++ dest = route.get('network') ++ if dest in default_nets: ++ dest = 'default' ++ gateway = route.get('gateway') ++ config_routes += ' '.join([dest, gateway]) ++ if dest != 'default': ++ config_routes += ' ' + route.get('netmask', '') ++ config_routes += '\n' ++ if config_routes: ++ route_file = '/etc/sysconfig/network/ifroute-%s' % if_name ++ util.write_file(route_file, config_routes) ++ + @property + def preferred_ntp_clients(self): + """The preferred ntp client is dependent on the version.""" diff --git a/cloud-init.changes b/cloud-init.changes index 836cd39..4a6c463 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,67 @@ +------------------------------------------------------------------- +Mon Jan 7 20:22:39 UTC 2019 - Robert Schweikert + +- Update to version 18.5 (bsc#1121878, boo#1116767) + + Remove + 0001-Fix-the-service-order-for-SUSE-distributions.patch + 0001-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch + 0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch + included upstream + + Forward port cloud-init-sysconf-ethsetup.patch + + Add cloud-init-write-routes.patch + + tests: add Disco release [Joshua Powers] + + net: render 'metric' values in per-subnet routes (LP: #1805871) + + write_files: add support for appending to files. [James Baxter] + + config: On ubuntu select cloud archive mirrors for armel, armhf, arm64. + (LP: #1805854) + + dhclient-hook: cleanups, tests and fix a bug on 'down' event. + + NoCloud: Allow top level 'network' key in network-config. (LP: #1798117) + + ovf: Fix ovf network config generation gateway/routes (LP: #1806103) + + azure: detect vnet migration via netlink media change event + [Tamilmani Manoharan] + + Azure: fix copy/paste error in error handling when reading azure ovf. + + [Adam DePue] + + tests: fix incorrect order of mocks in test_handle_zfs_root. + + doc: Change dns_nameserver property to dns_nameservers. [Tomer Cohen] + + OVF: identify label iso9660 filesystems with label 'OVF ENV'. + + logs: collect-logs ignore instance-data-sensitive.json on non-root user + (LP: #1805201) + + net: Ephemeral*Network: add connectivity check via URL + + azure: _poll_imds only retry on 404. Fail on Timeout (LP: #1803598) + + resizefs: Prefix discovered devpath with '/dev/' when path does not + exist [Igor Galić] + + azure: retry imds polling on requests.Timeout (LP: #1800223) + + azure: Accept variation in error msg from mount for ntfs volumes + [Jason Zions] (LP: #1799338) + + azure: fix regression introduced when persisting ephemeral dhcp lease + [asakkurr] + + azure: add udev rules to create cloud-init Gen2 disk name symlinks + (LP: #1797480) + + tests: ec2 mock missing httpretty user-data and instance-identity routes + + azure: remove /etc/netplan/90-hotplug-azure.yaml when net from IMDS + + azure: report ready to fabric after reprovision and reduce logging + [asakkurr] (LP: #1799594) + + query: better error when missing read permission on instance-data + + instance-data: fallback to instance-data.json if sensitive is absent. + (LP: #1798189) + + docs: remove colon from network v1 config example. [Tomer Cohen] + + Add cloud-id binary to packages for SUSE [Jason Zions] + + systemd: On SUSE ensure cloud-init.service runs before wicked + [Robert Schweikert] (LP: #1799709) + + update detection of openSUSE variants [Robert Schweikert] + + azure: Add apply_network_config option to disable network from IMDS + (LP: #1798424) + + Correct spelling in an error message (udevadm). [Katie McLaughlin] + + tests: meta_data key changed to meta-data in ec2 instance-data.json + (LP: #1797231) + + tests: fix kvm integration test to assert flexible config-disk path + (LP: #1797199) + + tools: Add cloud-id command line utility + + instance-data: Add standard keys platform and subplatform. Refactor ec2. + + net: ignore nics that have "zero" mac address. (LP: #1796917) + + tests: fix apt_configure_primary to be more flexible + + Ubuntu: update sources.list to comment out deb-src entries. (LP: #74747) + ------------------------------------------------------------------- Fri Nov 2 14:13:42 UTC 2018 - Robert Schweikert diff --git a/cloud-init.spec b/cloud-init.spec index ac3b221..ed7e58c 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -18,7 +18,7 @@ %global configver 0.7 Name: cloud-init -Version: 18.4 +Version: 18.5 Release: 0 License: GPL-3.0 and AGPL-3.0 Summary: Cloud node initialization tool @@ -37,22 +37,17 @@ Patch20: cloud-init-python2-sigpipe.patch Patch21: cloud-init-template-py2.patch Patch29: datasourceLocalDisk.patch Patch34: cloud-init-tests-set-exec.patch -# FIXME -# https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/357644 -Patch36: 0001-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch -Patch37: 0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch # FIXME no proposed solution Patch38: cloud-init-sysconf-path.patch # FIXME (lp#1799540) # https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/357710 Patch39: cloud-init-sysconf-ethsetup.patch -# FIXME (lp#1799709) -# https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/357752 -Patch40: 0001-Fix-the-service-order-for-SUSE-distributions.patch # FIXME (lp# 1800854) Patch41: cloud-init-static-net.patch # FIXME (lp#1801364) Patch42: cloud-init-ostack-metadat-dencode.patch +# FIXME (lp#1812117) +Patch43: cloud-init-write-routes.patch BuildRequires: fdupes BuildRequires: filesystem @@ -193,13 +188,11 @@ Documentation and examples for cloud-init tools %endif %patch29 -p0 %patch34 -%patch36 -p1 -%patch37 -p1 %patch38 -%patch39 -p1 -%patch40 -p1 +%patch39 %patch41 %patch42 +%patch43 %build %if 0%{?suse_version} && 0%{?suse_version} <= 1315 @@ -289,6 +282,7 @@ popd %defattr(-,root,root) # do not mark as doc or we get conflicts with the doc package %{docdir}/LICENSE +%{_bindir}/cloud-id %{_bindir}/cloud-init %{_bindir}/cloud-init-per %dir %{_sysconfdir}/cloud From 23997f352e16708249f3c00b4bba6aa4af53f79b4d9a8c664fcda842b7301198 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Fri, 18 Jan 2019 10:00:43 +0000 Subject: [PATCH 2/8] - Duh, actually remove the patches OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=126 --- ...service-order-for-SUSE-distributions.patch | 28 ----- ...bouncing-ball-for-openSUSE-distribut.patch | 40 ------- ...ditional-openSUSE-distro-condition-m.patch | 109 ------------------ 3 files changed, 177 deletions(-) delete mode 100644 0001-Fix-the-service-order-for-SUSE-distributions.patch delete mode 100644 0001-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch delete mode 100644 0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch diff --git a/0001-Fix-the-service-order-for-SUSE-distributions.patch b/0001-Fix-the-service-order-for-SUSE-distributions.patch deleted file mode 100644 index 25144b5..0000000 --- a/0001-Fix-the-service-order-for-SUSE-distributions.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1f7950f72dc5f3603118c0f91dca3fb7145f0801 Mon Sep 17 00:00:00 2001 -From: Robert Schweikert -Date: Wed, 24 Oct 2018 09:50:11 -0400 -Subject: [PATCH] - Fix the service order for SUSE distributions + Network - configuration file gets written when cloud-init.service runs. Therefore - this needs to run prior to the network tools (wicked) - ---- - systemd/cloud-init.service.tmpl | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl -index b92e8abc..5cb00371 100644 ---- a/systemd/cloud-init.service.tmpl -+++ b/systemd/cloud-init.service.tmpl -@@ -14,8 +14,7 @@ After=networking.service - After=network.service - {% endif %} - {% if variant in ["suse"] %} --Requires=wicked.service --After=wicked.service -+Before=wicked.service - # setting hostname via hostnamectl depends on dbus, which otherwise - # would not be guaranteed at this point. - After=dbus.service --- -2.13.7 - diff --git a/0001-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch b/0001-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch deleted file mode 100644 index 74e5835..0000000 --- a/0001-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch +++ /dev/null @@ -1,40 +0,0 @@ -From eb504025c76909175ab2d00c25232b89faf01ab4 Mon Sep 17 00:00:00 2001 -From: Robert Schweikert -Date: Sun, 21 Oct 2018 08:28:21 -0400 -Subject: [PATCH 1/2] - Follow the ever bouncing ball for openSUSE distribution - identification + openSUSE changed from identifying itself as "opensuse" in - os-release to "opensuse-tumbleweed" and "opensuse-leap". This breaks - template expansion - ---- - cloudinit/util.py | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/cloudinit/util.py b/cloudinit/util.py -index c67d6be6..7800f7bc 100644 ---- a/cloudinit/util.py -+++ b/cloudinit/util.py -@@ -615,8 +615,8 @@ def get_linux_distro(): - distro_name = os_release.get('ID', '') - distro_version = os_release.get('VERSION_ID', '') - if 'sles' in distro_name or 'suse' in distro_name: -- # RELEASE_BLOCKER: We will drop this sles ivergent behavior in -- # before 18.4 so that get_linux_distro returns a named tuple -+ # RELEASE_BLOCKER: We will drop this sles divergent behavior in -+ # the future so that get_linux_distro returns a named tuple - # which will include both version codename and architecture - # on all distributions. - flavor = platform.machine() -@@ -668,7 +668,8 @@ def system_info(): - var = 'ubuntu' - elif linux_dist == 'redhat': - var = 'rhel' -- elif linux_dist in ('opensuse', 'sles'): -+ elif linux_dist in ( -+ 'opensuse', 'opensuse-tumbleweed', 'opensuse-leap', 'sles'): - var = 'suse' - else: - var = 'linux' --- -2.13.7 - diff --git a/0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch b/0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch deleted file mode 100644 index af6aeec..0000000 --- a/0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 33d988113c3897ea7e0d1eda402d30dfec119602 Mon Sep 17 00:00:00 2001 -From: Robert Schweikert -Date: Sun, 21 Oct 2018 08:46:15 -0400 -Subject: [PATCH 2/2] - Add tests for additional openSUSE distro condition - mechanisms - ---- - cloudinit/tests/test_util.py | 75 ++++++++++++++++++++++++++++++++++---------- - 1 file changed, 59 insertions(+), 16 deletions(-) - -diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py -index 749a3846..c3f52c7b 100644 ---- a/cloudinit/tests/test_util.py -+++ b/cloudinit/tests/test_util.py -@@ -18,25 +18,51 @@ MOUNT_INFO = [ - ] - - OS_RELEASE_SLES = dedent("""\ -- NAME="SLES"\n -- VERSION="12-SP3"\n -- VERSION_ID="12.3"\n -- PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"\n -- ID="sles"\nANSI_COLOR="0;32"\n -- CPE_NAME="cpe:/o:suse:sles:12:sp3"\n -+ NAME="SLES" -+ VERSION="12-SP3" -+ VERSION_ID="12.3" -+ PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3" -+ ID="sles" -+ ANSI_COLOR="0;32" -+ CPE_NAME="cpe:/o:suse:sles:12:sp3" - """) - - OS_RELEASE_OPENSUSE = dedent("""\ --NAME="openSUSE Leap" --VERSION="42.3" --ID=opensuse --ID_LIKE="suse" --VERSION_ID="42.3" --PRETTY_NAME="openSUSE Leap 42.3" --ANSI_COLOR="0;32" --CPE_NAME="cpe:/o:opensuse:leap:42.3" --BUG_REPORT_URL="https://bugs.opensuse.org" --HOME_URL="https://www.opensuse.org/" -+ NAME="openSUSE Leap" -+ VERSION="42.3" -+ ID=opensuse -+ ID_LIKE="suse" -+ VERSION_ID="42.3" -+ PRETTY_NAME="openSUSE Leap 42.3" -+ ANSI_COLOR="0;32" -+ CPE_NAME="cpe:/o:opensuse:leap:42.3" -+ BUG_REPORT_URL="https://bugs.opensuse.org" -+ HOME_URL="https://www.opensuse.org/" -+""") -+ -+OS_RELEASE_OPENSUSE_L15 = dedent("""\ -+ NAME="openSUSE Leap" -+ VERSION="15.0" -+ ID="opensuse-leap" -+ ID_LIKE="suse opensuse" -+ VERSION_ID="15.0" -+ PRETTY_NAME="openSUSE Leap 15.0" -+ ANSI_COLOR="0;32" -+ CPE_NAME="cpe:/o:opensuse:leap:15.0" -+ BUG_REPORT_URL="https://bugs.opensuse.org" -+ HOME_URL="https://www.opensuse.org/" -+""") -+ -+OS_RELEASE_OPENSUSE_TW = dedent("""\ -+ NAME="openSUSE Tumbleweed" -+ ID="opensuse-tumbleweed" -+ ID_LIKE="opensuse suse" -+ VERSION_ID="20180920" -+ PRETTY_NAME="openSUSE Tumbleweed" -+ ANSI_COLOR="0;32" -+ CPE_NAME="cpe:/o:opensuse:tumbleweed:20180920" -+ BUG_REPORT_URL="https://bugs.opensuse.org" -+ HOME_URL="https://www.opensuse.org/" - """) - - OS_RELEASE_CENTOS = dedent("""\ -@@ -453,6 +479,23 @@ class TestGetLinuxDistro(CiTestCase): - dist = util.get_linux_distro() - self.assertEqual(('opensuse', '42.3', platform.machine()), dist) - -+ @mock.patch('cloudinit.util.load_file') -+ def test_get_linux_opensuse_l15(self, m_os_release, m_path_exists): -+ """Verify we get the correct name and machine arch on OpenSUSE.""" -+ m_os_release.return_value = OS_RELEASE_OPENSUSE_L15 -+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists -+ dist = util.get_linux_distro() -+ self.assertEqual(('opensuse-leap', '15.0', platform.machine()), dist) -+ -+ @mock.patch('cloudinit.util.load_file') -+ def test_get_linux_opensuse_tw(self, m_os_release, m_path_exists): -+ """Verify we get the correct name and machine arch on OpenSUSE.""" -+ m_os_release.return_value = OS_RELEASE_OPENSUSE_TW -+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists -+ dist = util.get_linux_distro() -+ self.assertEqual( -+ ('opensuse-tumbleweed', '20180920', platform.machine()), dist) -+ - @mock.patch('platform.dist') - def test_get_linux_distro_no_data(self, m_platform_dist, m_path_exists): - """Verify we get no information if os-release does not exist""" --- -2.13.7 - From 8d961f37186f4faad634fc70accbdc7c3cf8f307895fcf78ef584deb1f9afe49 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Sat, 19 Jan 2019 22:32:31 +0000 Subject: [PATCH 3/8] + Add cloud-init-handle-def-route-set.patch OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=127 --- cloud-init-handle-def-route-set.patch | 189 ++++++++++++++++++++++++++ cloud-init.changes | 1 + cloud-init.spec | 4 + 3 files changed, 194 insertions(+) create mode 100644 cloud-init-handle-def-route-set.patch diff --git a/cloud-init-handle-def-route-set.patch b/cloud-init-handle-def-route-set.patch new file mode 100644 index 0000000..7656475 --- /dev/null +++ b/cloud-init-handle-def-route-set.patch @@ -0,0 +1,189 @@ +--- cloudinit/net/network_state.py.orig ++++ cloudinit/net/network_state.py +@@ -148,6 +148,7 @@ class NetworkState(object): + self._network_state = copy.deepcopy(network_state) + self._version = version + self.use_ipv6 = network_state.get('use_ipv6', False) ++ self._has_default_route = self._find_default_route() + + @property + def config(self): +@@ -157,6 +158,10 @@ class NetworkState(object): + def version(self): + return self._version + ++ @property ++ def has_default_route(self): ++ return self._has_default_route ++ + def iter_routes(self, filter_func=None): + for route in self._network_state.get('routes', []): + if filter_func is not None: +@@ -188,6 +193,23 @@ class NetworkState(object): + if filter_func(iface): + yield iface + ++ def _find_default_route(self): ++ for route in self.iter_routes(): ++ if self._is_default_route(route): ++ return True ++ for iface in self.iter_interfaces(): ++ for subnet in iface.get('subnets', []): ++ for route in subnet.get('routes', []): ++ if self._is_default_route(route): ++ return True ++ ++ def _is_default_route(self, route): ++ default_nets = ('::', '0.0.0.0') ++ return ( ++ route.get('prefix') == 0 and ++ route.get('network') in default_nets ++ ) ++ + + @six.add_metaclass(CommandHandlerMeta) + class NetworkStateInterpreter(object): +--- cloudinit/net/sysconfig.py.orig ++++ cloudinit/net/sysconfig.py +@@ -310,6 +310,7 @@ class Renderer(renderer.Renderer): + mtu_key = 'MTU' + subnet_type = subnet.get('type') + if subnet_type == 'dhcp6': ++ # TODO need to set BOOTPROTO to dhcp6 on SUSE + iface_cfg['IPV6INIT'] = True + iface_cfg['DHCPV6C'] = True + elif subnet_type in ['dhcp4', 'dhcp']: +@@ -355,9 +356,12 @@ class Renderer(renderer.Renderer): + ipv6_index = -1 + for i, subnet in enumerate(subnets, start=len(iface_cfg.children)): + subnet_type = subnet.get('type') +- if subnet_type == 'dhcp6': +- continue +- elif subnet_type in ['dhcp4', 'dhcp']: ++ if subnet_type in ['dhcp', 'dhcp4', 'dhcp6']: ++ if ( ++ cls._network_default_route and ++ iface_cfg['BOOTPROTO'] != 'none' ++ ): ++ iface_cfg['DHCLIENT_SET_DEFAULT_ROUTE'] = False + continue + elif subnet_type == 'static': + if subnet_is_ipv6(subnet): +@@ -423,6 +427,8 @@ class Renderer(renderer.Renderer): + # TODO(harlowja): add validation that no other iface has + # also provided the default route? + iface_cfg['DEFROUTE'] = True ++ if iface_cfg['BOOTPROTO'] in ('dhcp', 'dhcp4', 'dhcp6'): ++ iface_cfg['DHCLIENT_SET_DEFAULT_ROUTE'] = True + if 'gateway' in route: + if is_ipv6 or is_ipv6_addr(route['gateway']): + iface_cfg['IPV6_DEFAULTGW'] = route['gateway'] +@@ -636,6 +642,10 @@ class Renderer(renderer.Renderer): + return contents + + def render_network_state(self, network_state, templates=None, target=None): ++ # Force the knowledge of a default route for the network state ++ # into the renderer, this is needed to write the proper ifcfg- ++ # on SUSE distros ++ self.__class__._network_default_route = network_state.has_default_route + if not templates: + templates = self.templates + file_mode = 0o644 +--- tests/unittests/test_net.py.orig ++++ tests/unittests/test_net.py +@@ -538,6 +538,7 @@ NETWORK_CONFIGS = { + BOOTPROTO=dhcp + DEFROUTE=yes + DEVICE=eth99 ++ DHCLIENT_SET_DEFAULT_ROUTE=yes + DNS1=8.8.8.8 + DNS2=8.8.4.4 + DOMAIN="barley.maas sach.maas" +@@ -912,6 +913,7 @@ pre-down route del -net 10.0.0.0 netmask + 'ifcfg-bond0.200': textwrap.dedent("""\ + BOOTPROTO=dhcp + DEVICE=bond0.200 ++ DHCLIENT_SET_DEFAULT_ROUTE=no + NM_CONTROLLED=no + ONBOOT=yes + STARTMODE=auto +@@ -1011,6 +1013,7 @@ pre-down route del -net 10.0.0.0 netmask + 'ifcfg-eth5': textwrap.dedent("""\ + BOOTPROTO=dhcp + DEVICE=eth5 ++ DHCLIENT_SET_DEFAULT_ROUTE=no + HWADDR=98:bb:9f:2c:e8:8a + NM_CONTROLLED=no + ONBOOT=no +@@ -1666,6 +1669,23 @@ CONFIG_V1_SIMPLE_SUBNET = { + 'type': 'static'}], + 'type': 'physical'}]} + ++CONFIG_V1_MULTI_IFACE = { ++ 'version': 1, ++ 'config': [{'type': 'physical', ++ 'mtu': 1500, ++ 'subnets': [{'type': 'static', ++ 'netmask': '255.255.240.0', ++ 'routes': [{'netmask': '0.0.0.0', ++ 'network': '0.0.0.0', ++ 'gateway': '51.68.80.1'}], ++ 'address': '51.68.89.122', ++ 'ipv4': True}], ++ 'mac_address': 'fa:16:3e:25:b4:59', ++ 'name': 'eth0'}, ++ {'type': 'physical', ++ 'mtu': 9000, ++ 'subnets': [{'type': 'dhcp4'}], ++ 'mac_address': 'fa:16:3e:b1:ca:29', 'name': 'eth1'}]} + + DEFAULT_DEV_ATTRS = { + 'eth1000': { +@@ -2133,6 +2153,47 @@ USERCTL=no + """ + self.assertEqual(expected, found[nspath + 'ifcfg-interface0']) + ++ def test_network_config_v1_multi_iface_samples(self): ++ ns = network_state.parse_net_config_data(CONFIG_V1_MULTI_IFACE) ++ render_dir = self.tmp_path("render") ++ os.makedirs(render_dir) ++ renderer = self._get_renderer() ++ renderer.render_network_state(ns, target=render_dir) ++ found = dir2dict(render_dir) ++ nspath = '/etc/sysconfig/network-scripts/' ++ self.assertNotIn(nspath + 'ifcfg-lo', found.keys()) ++ expected_i1 = """\ ++# Created by cloud-init on instance boot automatically, do not edit. ++# ++BOOTPROTO=none ++DEFROUTE=yes ++DEVICE=eth0 ++GATEWAY=51.68.80.1 ++HWADDR=fa:16:3e:25:b4:59 ++IPADDR=51.68.89.122 ++MTU=1500 ++NETMASK=255.255.240.0 ++NM_CONTROLLED=no ++ONBOOT=yes ++TYPE=Ethernet ++USERCTL=no ++""" ++ self.assertEqual(expected_i1, found[nspath + 'ifcfg-eth0']) ++ expected_i2 = """\ ++# Created by cloud-init on instance boot automatically, do not edit. ++# ++BOOTPROTO=dhcp ++DEVICE=eth1 ++DHCLIENT_SET_DEFAULT_ROUTE=no ++HWADDR=fa:16:3e:b1:ca:29 ++MTU=9000 ++NM_CONTROLLED=no ++ONBOOT=yes ++TYPE=Ethernet ++USERCTL=no ++""" ++ self.assertEqual(expected_i2, found[nspath + 'ifcfg-eth1']) ++ + def test_config_with_explicit_loopback(self): + ns = network_state.parse_net_config_data(CONFIG_V1_EXPLICIT_LOOPBACK) + render_dir = self.tmp_path("render") diff --git a/cloud-init.changes b/cloud-init.changes index 4a6c463..c792340 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -9,6 +9,7 @@ Mon Jan 7 20:22:39 UTC 2019 - Robert Schweikert included upstream + Forward port cloud-init-sysconf-ethsetup.patch + Add cloud-init-write-routes.patch + + Add cloud-init-handle-def-route-set.patch + tests: add Disco release [Joshua Powers] + net: render 'metric' values in per-subnet routes (LP: #1805871) + write_files: add support for appending to files. [James Baxter] diff --git a/cloud-init.spec b/cloud-init.spec index ed7e58c..5c20d5d 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -48,6 +48,9 @@ Patch41: cloud-init-static-net.patch Patch42: cloud-init-ostack-metadat-dencode.patch # FIXME (lp#1812117) Patch43: cloud-init-write-routes.patch +# Following submitted upstream +Patch44: cloud-init-handle-def-route-set.patch +# End lp#1812117 BuildRequires: fdupes BuildRequires: filesystem @@ -193,6 +196,7 @@ Documentation and examples for cloud-init tools %patch41 %patch42 %patch43 +%patch44 %build %if 0%{?suse_version} && 0%{?suse_version} <= 1315 From 3664ce16597bc825cc8a3956140838f4415911a3cb26515d7358f1c412750bbe Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Mon, 21 Jan 2019 13:28:00 +0000 Subject: [PATCH 4/8] - Write dashes to ifroute-* files OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=128 --- cloud-init-write-routes.patch | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cloud-init-write-routes.patch b/cloud-init-write-routes.patch index a86f8cd..99221b9 100644 --- a/cloud-init-write-routes.patch +++ b/cloud-init-write-routes.patch @@ -1,6 +1,6 @@ --- cloudinit/distros/opensuse.py.orig +++ cloudinit/distros/opensuse.py -@@ -172,8 +172,37 @@ class Distro(distros.Distro): +@@ -172,8 +172,40 @@ class Distro(distros.Distro): util.write_file(out_fn, str(conf), 0o644) def _write_network_config(self, netconfig): @@ -30,6 +30,9 @@ + config_routes += ' '.join([dest, gateway]) + if dest != 'default': + config_routes += ' ' + route.get('netmask', '') ++ else: ++ config_routes += ' -' ++ config_routes += ' - -' + config_routes += '\n' + if config_routes: + route_file = '/etc/sysconfig/network/ifroute-%s' % if_name From 343fb12d7e2eefe801b12443b75906fdc63a32b9b9a6f5aace53b6f70547ad6d Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Tue, 22 Jan 2019 13:07:42 +0000 Subject: [PATCH 5/8] - Add cloud-init-no-empty-resolv.patch (bsc#1119397) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=129 --- cloud-init-no-empty-resolv.patch | 21 +++++++++++++++++++++ cloud-init.changes | 5 +++++ cloud-init.spec | 5 ++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 cloud-init-no-empty-resolv.patch diff --git a/cloud-init-no-empty-resolv.patch b/cloud-init-no-empty-resolv.patch new file mode 100644 index 0000000..349f254 --- /dev/null +++ b/cloud-init-no-empty-resolv.patch @@ -0,0 +1,21 @@ +--- cloudinit/net/sysconfig.py.orig ++++ cloudinit/net/sysconfig.py +@@ -545,6 +545,8 @@ class Renderer(renderer.Renderer): + content.add_nameserver(nameserver) + for searchdomain in network_state.dns_searchdomains: + content.add_search_domain(searchdomain) ++ if not content: ++ return content + header = _make_header(';') + content_str = str(content) + if not content_str.startswith(header): +@@ -658,7 +660,8 @@ class Renderer(renderer.Renderer): + dns_path = util.target_path(target, self.dns_path) + resolv_content = self._render_dns(network_state, + existing_dns_path=dns_path) +- util.write_file(dns_path, resolv_content, file_mode) ++ if resolv_content: ++ util.write_file(dns_path, resolv_content, file_mode) + if self.networkmanager_conf_path: + nm_conf_path = util.target_path(target, + self.networkmanager_conf_path) diff --git a/cloud-init.changes b/cloud-init.changes index c792340..e2af5cb 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jan 22 13:04:40 UTC 2019 - Robert Schweikert + +- Add cloud-init-no-empty-resolv.patch (bsc#1119397) + ------------------------------------------------------------------- Mon Jan 7 20:22:39 UTC 2019 - Robert Schweikert diff --git a/cloud-init.spec b/cloud-init.spec index 5c20d5d..52b8a1a 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,7 +1,7 @@ # # spec file for package cloud-init # -# Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -51,6 +51,8 @@ Patch43: cloud-init-write-routes.patch # Following submitted upstream Patch44: cloud-init-handle-def-route-set.patch # End lp#1812117 +# FIXME +Patch45: cloud-init-no-empty-resolv.patch BuildRequires: fdupes BuildRequires: filesystem @@ -197,6 +199,7 @@ Documentation and examples for cloud-init tools %patch42 %patch43 %patch44 +%patch45 %build %if 0%{?suse_version} && 0%{?suse_version} <= 1315 From cf38f0cf58d0bfe39a2e2db6a002267c9992007b723cf8db91f125bbbb3036cf Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Tue, 22 Jan 2019 13:13:14 +0000 Subject: [PATCH 6/8] - ADd lp bug number as reference OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=130 --- cloud-init.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-init.spec b/cloud-init.spec index 52b8a1a..d7244fb 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -51,7 +51,7 @@ Patch43: cloud-init-write-routes.patch # Following submitted upstream Patch44: cloud-init-handle-def-route-set.patch # End lp#1812117 -# FIXME +# FIXME (lp#1812853) Patch45: cloud-init-no-empty-resolv.patch BuildRequires: fdupes From 99ef69f82c84520a98b96d6559cd9b5197bfa237ae6e4cd5d0f7797f01ae5b94 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Wed, 23 Jan 2019 13:32:41 +0000 Subject: [PATCH 7/8] - Fix patch, duh OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=131 --- cloud-init-no-empty-resolv.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-init-no-empty-resolv.patch b/cloud-init-no-empty-resolv.patch index 349f254..1eb9365 100644 --- a/cloud-init-no-empty-resolv.patch +++ b/cloud-init-no-empty-resolv.patch @@ -4,7 +4,7 @@ content.add_nameserver(nameserver) for searchdomain in network_state.dns_searchdomains: content.add_search_domain(searchdomain) -+ if not content: ++ if not str(content): + return content header = _make_header(';') content_str = str(content) From c53e82e2885535d97daa6474d3bde5fb6209bb3361364219c669b1e237179bbc Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Wed, 23 Jan 2019 13:40:34 +0000 Subject: [PATCH 8/8] - Fix it again, duh OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=132 --- cloud-init-no-empty-resolv.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-init-no-empty-resolv.patch b/cloud-init-no-empty-resolv.patch index 1eb9365..1efad05 100644 --- a/cloud-init-no-empty-resolv.patch +++ b/cloud-init-no-empty-resolv.patch @@ -5,7 +5,7 @@ for searchdomain in network_state.dns_searchdomains: content.add_search_domain(searchdomain) + if not str(content): -+ return content ++ return str(content) header = _make_header(';') content_str = str(content) if not content_str.startswith(header):