handle missing udev process

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=239
This commit is contained in:
Robert Schweikert 2025-01-06 13:51:27 +00:00 committed by Git OBS Bridge
parent fb5493d9e8
commit 14e9c00f78

View File

@ -1,12 +1,15 @@
--- cloudinit/sources/helpers/openstack.py.orig --- cloudinit/sources/helpers/openstack.py.orig
+++ cloudinit/sources/helpers/openstack.py +++ cloudinit/sources/helpers/openstack.py
@@ -736,7 +736,11 @@ def convert_net_json(network_json=None, @@ -736,7 +736,14 @@ def convert_net_json(network_json=None,
if not mac: if not mac:
raise ValueError("No mac_address or name entry for %s" % d) raise ValueError("No mac_address or name entry for %s" % d)
if mac not in known_macs: if mac not in known_macs:
- raise ValueError("Unable to find a system nic for %s" % d) - raise ValueError("Unable to find a system nic for %s" % d)
+ # Let's give udev a chance to catch up + # Let's give udev a chance to catch up
+ util.udevadm_settle() + try:
+ util.udevadm_settle()
+ exceptsubp.ProcessExecutionError:
+ pass
+ known_macs = net.get_interfaces_by_mac() + known_macs = net.get_interfaces_by_mac()
+ if mac not in known_macs: + if mac not in known_macs:
+ raise ValueError("Unable to find a system nic for %s" % d) + raise ValueError("Unable to find a system nic for %s" % d)