forked from pool/cloud-init
Robert Schweikert
9bf9eed94a
+ 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
25 lines
622 B
Diff
25 lines
622 B
Diff
--- 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
|