[PATCH rhel7-branch] Check for device state races also for Dhcp4Config (#1005681)
Vratislav Podzimek
vpodzime at redhat.com
Tue Sep 10 10:16:16 UTC 2013
On Tue, 2013-09-10 at 12:05 +0200, Radek Vykydal wrote:
> ---
> 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
We were discussing with Radek that it might be better to do the 'if
"org.freedesktop.DBus.Error.UnknownMethod" in e.message:' check in the
_get_property() method and raise some special "CannotCallGetError"
instead that could be caught by the callers without doing the low-level
check of GLib.GError's message.
Apart from this change all these look good to me.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list