SHA256
1
0
forked from pool/cloud-init
cloud-init/cloud-init-trigger-udev.patch
Robert Schweikert ddfb957280 - Add cloud-init-add-static-routes.diff (bsc#1141969)
+ Properly handle static routes. The EphemeralDHCP context manager did
    not parse or handle rfc3442 classless static routes which prevented
    reading datasource metadata in some clouds.

- Update cloud-init-trigger-udev.patch (bsc#1144363)
  - The __str__ implementation no longer delivers the name of the interface,
    use the "name" attribute instead to form a proper path in the
    sysfs tree

- Update cloud-init-write-routes.patch (bsc#1144881)
  + If no routes are set for a subnet but the subnet has a gateway
    specified, set the gateway as the default route for the interface

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=144
2019-09-05 13:32:10 +00:00

37 lines
1.7 KiB
Diff

--- cloudinit/distros/opensuse.py.orig
+++ cloudinit/distros/opensuse.py
@@ -38,6 +38,8 @@ class Distro(distros.Distro):
'sysconfig': {
'control': 'etc/sysconfig/network/config',
'iface_templates': '%(base)s/network/ifcfg-%(name)s',
+ 'netrules_path': (
+ 'etc/udev/rules.d/85-persistent-net-cloud-init.rules'),
'route_templates': {
'ipv4': '%(base)s/network/ifroute-%(name)s',
'ipv6': '%(base)s/network/ifroute-%(name)s',
--- cloudinit/net/sysconfig.py.orig
+++ cloudinit/net/sysconfig.py
@@ -8,6 +8,7 @@ import six
from cloudinit.distros.parsers import networkmanager_conf
from cloudinit.distros.parsers import resolv_conf
from cloudinit import log as logging
+from cloudinit import net
from cloudinit import util
from configobj import ConfigObj
@@ -699,6 +700,14 @@ class Renderer(renderer.Renderer):
if nm_conf_content:
util.write_file(nm_conf_path, nm_conf_content, file_mode)
if self.netrules_path:
+ # When many interfaces are present it can happen that we get here
+ # before they are all setup. Settle if that is the case.
+ for iface in network_state.iter_interfaces(
+ renderer.filter_by_physical):
+ path = net.sys_dev_path(iface.name)
+ if not os.path.exists(path):
+ util.udevadm_settle(path, 5)
+ break
netrules_content = self._render_persistent_net(network_state)
netrules_path = util.target_path(target, self.netrules_path)
util.write_file(netrules_path, netrules_content, file_mode)