[PATCH rhel7-branch] Check for device state races also for Dhcp4Config (#1005681)

Radek Vykydal rvykydal at redhat.com
Tue Sep 10 10:05:34 UTC 2013


---
 pyanaconda/nm.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/nm.py b/pyanaconda/nm.py
index e91aa26..24ca1aa 100644
--- a/pyanaconda/nm.py
+++ b/pyanaconda/nm.py
@@ -357,7 +357,14 @@ def nm_ntp_servers_from_dhcp():
     for device in active_devices:
         # harvest NTP server addresses from DHCPv4
         dhcp4_path = nm_device_property(device, "Dhcp4Config")
-        options = _get_property(dhcp4_path, "Options", ".DHCP4Config")
+        try:
+            options = _get_property(dhcp4_path, "Options", ".DHCP4Config")
+        except GLib.GError as e:
+            # checking the device state (has to be ACTIVATED) is racy
+            if "org.freedesktop.DBus.Error.UnknownMethod" in e.message:
+                options = None
+            else:
+                raise
         if options and 'ntp_servers' in options:
             # NTP server addresses returned by DHCP are whitespace delimited
             ntp_servers_string = options["ntp_servers"]
-- 
1.7.11.7



More information about the anaconda-patches mailing list