SHA256
1
0
forked from pool/cloud-init
cloud-init/cloud-init-write-routes.patch

60 lines
2.5 KiB
Diff
Raw Normal View History

- 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) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125
2019-01-18 10:50:54 +01:00
--- cloudinit/distros/opensuse.py.orig
+++ cloudinit/distros/opensuse.py
@@ -11,6 +11,7 @@
from cloudinit import distros
from cloudinit.distros.parsers.hostname import HostnameConf
+from cloudinit.net.network_state import mask_to_net_prefix
from cloudinit import helpers
from cloudinit import log as logging
@@ -172,7 +173,47 @@ class Distro(distros.Distro):
- 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) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125
2019-01-18 10:50:54 +01:00
util.write_file(out_fn, str(conf), 0o644)
def _write_network_config(self, netconfig):
- return self._supported_write_network_config(netconfig)
+ net_apply_res = self._supported_write_network_config(netconfig)
+ # Clobber the route files that were written in RH key-value style
- 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) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125
2019-01-18 10:50:54 +01:00
+ self._write_routes(netconfig)
+ return net_apply_res
+
- 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) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125
2019-01-18 10:50:54 +01:00
+ 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', [])
+ config_routes = ''
- 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) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125
2019-01-18 10:50:54 +01:00
+ for subnet in subnets:
+ routes = subnet.get('routes', [])
+ for route in routes:
+ dest = route.get('network')
+ if dest in default_nets:
+ dest = 'default'
+ if dest != 'default':
+ prefix = mask_to_net_prefix(route.get('netmask'))
+ dest += '/' + str(prefix)
+ gateway = route.get('gateway')
+ config_routes += ' '.join(
+ [dest, gateway, '-', '-\n']
+ )
+ if not config_routes:
+ dest = 'default'
+ gateway = subnet.get('gateway')
+ if gateway:
+ config_routes += ' '.join(
+ [dest, gateway, '-', '-\n']
+ )
- 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) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125
2019-01-18 10:50:54 +01:00
+ if config_routes:
+ route_file = '/etc/sysconfig/network/ifroute-%s' % if_name
+ util.write_file(route_file, config_routes)
- 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) OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=125
2019-01-18 10:50:54 +01:00
@property
def preferred_ntp_clients(self):