From 9bf9eed94a6b6c1ca3c882f65df5767330d7eb63a0b87a23fdc5a427825c7d4d Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Mon, 3 Jun 2024 19:58:00 +0000 Subject: [PATCH] - Add cloud-init-skip-rename.patch (bsc#1219680) + Brute force appraoch to skip renames if the device is already present OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=233 --- cloud-init-skip-rename.patch | 24 ++++++++++++++++++++++++ cloud-init.changes | 6 ++++++ cloud-init.spec | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 cloud-init-skip-rename.patch diff --git a/cloud-init-skip-rename.patch b/cloud-init-skip-rename.patch new file mode 100644 index 0000000..30d897b --- /dev/null +++ b/cloud-init-skip-rename.patch @@ -0,0 +1,24 @@ +--- cloudinit/net/__init__.py.orig ++++ cloudinit/net/__init__.py +@@ -7,6 +7,7 @@ + + import errno + import functools ++import glob + import ipaddress + import logging + import os +@@ -698,6 +699,12 @@ def _rename_interfaces( + renames, strict_present=True, strict_busy=True, current_info=None + ): + ++ net_devs = glob.glob('/sys/class/net/*') ++ for dev in net_devs: ++ dev_name = dev.split('/')[-1] ++ for dev_data in renames: ++ if dev_name in dev_data: ++ del renames[renames.index(dev_data)] ++ + if not len(renames): + LOG.debug("no interfaces to rename") + return diff --git a/cloud-init.changes b/cloud-init.changes index aa37276..72efd99 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jun 3 19:53:46 UTC 2024 - Robert Schweikert + +- Add cloud-init-skip-rename.patch (bsc#1219680) + + Brute force appraoch to skip renames if the device is already present + ------------------------------------------------------------------- Mon Apr 29 21:49:48 UTC 2024 - Robert Schweikert diff --git a/cloud-init.spec b/cloud-init.spec index 13cf838..9a75a7c 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -51,6 +51,8 @@ Patch12: cloud-init-no-openstack-guess.patch Patch13: cloud-init-no-nmcfg-needed.patch # FIXME https://github.com/canonical/cloud-init/pull/5161 Patch14: cloud-init-usr-sudoers.patch +# FIXME https://github.com/canonical/cloud-init/issues/5075 +Patch15: cloud-init-skip-rename.patch BuildRequires: fdupes BuildRequires: filesystem # pkg-config is needed to find correct systemd unit dir @@ -163,6 +165,7 @@ Documentation and examples for cloud-init tools %patch -P 12 %patch -P 13 %patch -P 14 +%patch -P 15 # patch in the full version to version.py version_pys=$(find . -name version.py -type f)