anaconda/bugfix-network-get-hwadddr-when-binding-to-mac-more-robustl.patch
xuxiaolong 27667a0985 sync 49 fixbug from github
(cherry picked from commit 0cd8608199f6b9726c451e0e9fe3be4a1dbe7cca)
2021-04-27 14:12:18 +08:00

30 lines
1.2 KiB
Diff

From 72c5df1cb3ee8636fc6901aaf6192f7e147ed399 Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
Date: Wed, 9 Sep 2020 15:36:35 +0200
Subject: [PATCH] network: get hwadddr when binding to mac more robustly
---
pyanaconda/modules/network/nm_client.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/modules/network/nm_client.py b/pyanaconda/modules/network/nm_client.py
index 4473c0110..04ae78d90 100644
--- a/pyanaconda/modules/network/nm_client.py
+++ b/pyanaconda/modules/network/nm_client.py
@@ -695,7 +695,11 @@ def bind_settings_to_mac(nm_client, s_connection, s_wired, device_name=None, bin
return False
device = nm_client.get_device_by_iface(iface)
if device:
- hwaddr = device.get_permanent_hw_address() or device.get_hw_address()
+ try:
+ perm_hwaddr = device.get_permanent_hw_address()
+ except AttributeError:
+ perm_hwaddr = None
+ hwaddr = perm_hwaddr or device.get_hw_address()
s_wired.props.mac_address = hwaddr
log.debug("Bind to mac: bound to %s", hwaddr)
modified = True
--
2.23.0