- Add cloud-init-trigger-udev.patch (bsc#1125950)

+ When the user configures a new rules file for network devices
    the rules may not apply immediately, trigger udevadm

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=136
This commit is contained in:
Robert Schweikert 2019-02-22 22:18:27 +00:00 committed by Git OBS Bridge
parent 64e78007b9
commit f30a915a55
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,35 @@
--- cloudinit/net/sysconfig.py.orig
+++ cloudinit/net/sysconfig.py
@@ -15,6 +15,7 @@ from .network_state import (
is_ipv6_addr, net_prefix_to_ipv4_mask, subnet_is_ipv6)
LOG = logging.getLogger(__name__)
+PERS_NET_RULES_DEFAULT = 'etc/udev/rules.d/70-persistent-net.rules'
def _make_header(sep='#'):
@@ -276,7 +277,7 @@ class Renderer(renderer.Renderer):
config = {}
self.sysconf_dir = config.get('sysconf_dir', 'etc/sysconfig')
self.netrules_path = config.get(
- 'netrules_path', 'etc/udev/rules.d/70-persistent-net.rules')
+ 'netrules_path', PERS_NET_RULES_DEFAULT)
self.dns_path = config.get('dns_path', 'etc/resolv.conf')
nm_conf_path = 'etc/NetworkManager/conf.d/99-cloud-init.conf'
self.networkmanager_conf_path = config.get('networkmanager_conf_path',
@@ -676,6 +677,15 @@ class Renderer(renderer.Renderer):
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)
+ # Making the assumption that the configured file is in a sane
+ # location
+ if (
+ os.path.basename(PERS_NET_RULES_DEFAULT)
+ != os.path.basename(netrules_path)
+ ):
+ util.subp(
+ ['udevadm', 'trigger', '-a ACTION=add', '-a SUBSYSTEM=net']
+ )
sysconfig_path = util.target_path(target, templates.get('control'))
# Distros configuring /etc/sysconfig/network as a file e.g. Centos

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Feb 22 22:11:20 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
- Add cloud-init-trigger-udev.patch (bsc#1125950)
+ When the user configures a new rules file for network devices
the rules may not apply immediately, trigger udevadm
-------------------------------------------------------------------
Fri Feb 22 16:20:28 UTC 2019 - Robert Schweikert <rjschwei@suse.com>

View File

@ -55,6 +55,8 @@ Patch44: cloud-init-handle-def-route-set.patch
Patch45: cloud-init-no-empty-resolv.patch
# FIXME (lp#1817230)
Patch46: cloud-init-proper-ipv6-varname.patch
# FIXME (lp#1817368)
Patch47: cloud-init-trigger-udev.patch
BuildRequires: fdupes
BuildRequires: filesystem
@ -203,6 +205,7 @@ Documentation and examples for cloud-init tools
%patch44
%patch45
%patch46
%patch47
%build
%if 0%{?suse_version} && 0%{?suse_version} <= 1315