From f30a915a55cfeecd1f56c712ed552f22cee05488d4af8deeaf855898dfcf68fc Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Fri, 22 Feb 2019 22:18:27 +0000 Subject: [PATCH] - 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 --- cloud-init-trigger-udev.patch | 35 +++++++++++++++++++++++++++++++++++ cloud-init.changes | 7 +++++++ cloud-init.spec | 3 +++ 3 files changed, 45 insertions(+) create mode 100644 cloud-init-trigger-udev.patch diff --git a/cloud-init-trigger-udev.patch b/cloud-init-trigger-udev.patch new file mode 100644 index 0000000..8f58bbe --- /dev/null +++ b/cloud-init-trigger-udev.patch @@ -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 diff --git a/cloud-init.changes b/cloud-init.changes index 29ea4ee..9f0bec6 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Feb 22 22:11:20 UTC 2019 - Robert Schweikert + +- 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 diff --git a/cloud-init.spec b/cloud-init.spec index dfaf036..75200e0 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -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