[PATCH 5/5 rhel7-branch] Catch race of network device state vs reading its config properties (#919478)
Radek Vykydal
rvykydal at redhat.com
Tue Sep 10 09:37:41 UTC 2013
Fedora bz: #980576
Catch the infamous
DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties"
doesn't exist
exception.
Object with path from devices's IPXConfig property is valid only if
its device is in ACTIVATED state.
---
pyanaconda/nm.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/nm.py b/pyanaconda/nm.py
index dd0df99..e91aa26 100644
--- a/pyanaconda/nm.py
+++ b/pyanaconda/nm.py
@@ -305,7 +305,15 @@ def nm_device_ip_config(name, version=4):
if config == "/":
return []
- addresses = _get_property(config, "Addresses", dbus_iface)
+ try:
+ addresses = _get_property(config, "Addresses", dbus_iface)
+ except GLib.GError as e:
+ # checking the device state (has to be ACTIVATED) is racy
+ if "org.freedesktop.DBus.Error.UnknownMethod" in e.message:
+ return []
+ else:
+ raise
+
addr_list = []
for addr, prefix, gateway in addresses:
# TODO - look for a library function (could have used IPy but byte order!)
@@ -317,7 +325,15 @@ def nm_device_ip_config(name, version=4):
gateway_str = nm_dbus_ay_to_ipv6(gateway)
addr_list.append([addr_str, prefix, gateway_str])
- nameservers = _get_property(config, "Nameservers", dbus_iface)
+ try:
+ nameservers = _get_property(config, "Nameservers", dbus_iface)
+ except GLib.GError as e:
+ # checking the device state (has to be ACTIVATED) is racy
+ if "org.freedesktop.DBus.Error.UnknownMethod" in e.message:
+ return []
+ else:
+ raise
+
ns_list = []
for ns in nameservers:
# TODO - look for a library function
--
1.7.11.7
More information about the anaconda-patches
mailing list