Hello community, here is the log from the commit of package cloud-init for openSUSE:Factory checked in at 2019-01-24 14:15:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cloud-init (Old) and /work/SRC/openSUSE:Factory/.cloud-init.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cloud-init" Thu Jan 24 14:15:09 2019 rev:55 rq:668094 version:18.5 Changes: -------- --- /work/SRC/openSUSE:Factory/cloud-init/cloud-init.changes 2018-11-05 22:54:53.424093752 +0100 +++ /work/SRC/openSUSE:Factory/.cloud-init.new.28833/cloud-init.changes 2019-01-24 14:15:10.963239917 +0100 @@ -1,0 +2,70 @@ +Tue Jan 22 13:04:40 UTC 2019 - Robert Schweikert <[email protected]> + +- Add cloud-init-no-empty-resolv.patch (bsc#1119397) + +------------------------------------------------------------------- +Mon Jan 7 20:22:39 UTC 2019 - Robert Schweikert <[email protected]> + +- 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 + + 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] + + 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) + +------------------------------------------------------------------- Old: ---- 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 cloud-init-18.4.tar.gz New: ---- cloud-init-18.5.tar.gz cloud-init-handle-def-route-set.patch cloud-init-no-empty-resolv.patch cloud-init-write-routes.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cloud-init.spec ++++++ --- /var/tmp/diff_new_pack.oaNeKd/_old 2019-01-24 14:15:11.587239195 +0100 +++ /var/tmp/diff_new_pack.oaNeKd/_new 2019-01-24 14:15:11.591239190 +0100 @@ -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 @@ -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,22 @@ 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 +# Following submitted upstream +Patch44: cloud-init-handle-def-route-set.patch +# End lp#1812117 +# FIXME (lp#1812853) +Patch45: cloud-init-no-empty-resolv.patch BuildRequires: fdupes BuildRequires: filesystem @@ -193,13 +193,13 @@ %endif %patch29 -p0 %patch34 -%patch36 -p1 -%patch37 -p1 %patch38 -%patch39 -p1 -%patch40 -p1 +%patch39 %patch41 %patch42 +%patch43 +%patch44 +%patch45 %build %if 0%{?suse_version} && 0%{?suse_version} <= 1315 @@ -289,6 +289,7 @@ %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 ++++++ cloud-init-18.4.tar.gz -> cloud-init-18.5.tar.gz ++++++ ++++ 6428 lines of diff (skipped) ++++++ cloud-init-handle-def-route-set.patch ++++++ --- 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") ++++++ cloud-init-no-empty-resolv.patch ++++++ --- 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 str(content): + return str(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) ++++++ cloud-init-sysconf-ethsetup.patch ++++++ --- /var/tmp/diff_new_pack.oaNeKd/_old 2019-01-24 14:15:11.779238973 +0100 +++ /var/tmp/diff_new_pack.oaNeKd/_new 2019-01-24 14:15:11.779238973 +0100 @@ -1,20 +1,6 @@ -From 6732e10fa677566a2ddcbc7ff6727cf697d35761 Mon Sep 17 00:00:00 2001 -From: Robert Schweikert <[email protected]> -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 @@ ]) # 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 @@ # 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ TYPE=Ethernet USERCTL=no """ --- -2.19.0 - ++++++ cloud-init-write-routes.patch ++++++ --- cloudinit/distros/opensuse.py.orig +++ cloudinit/distros/opensuse.py @@ -172,8 +172,40 @@ 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', '') + else: + config_routes += ' -' + config_routes += ' - -' + 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."""
