[blivet:master] Add likely to be raised exceptions to catch block (#1150174)
Brian C. Lane
bcl at redhat.com
Tue Oct 7 20:43:14 UTC 2014
On Tue, Oct 07, 2014 at 02:26:42PM -0400, mulhern wrote:
> Resolves: fed#1150174
>
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
> blivet/devices/storage.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
> index 28a9d4f..6fb8a63 100644
> --- a/blivet/devices/storage.py
> +++ b/blivet/devices/storage.py
> @@ -297,7 +297,12 @@ class StorageDevice(Device):
> try:
> udev_device = pyudev.Device.from_device_file(udev.global_udev,
> self.path)
> - except pyudev.DeviceNotFoundError as e:
> +
> + # from_device_file() does not process exceptions but just propagates
> + # ValueErrors and EnvironmentErrors that may be raised. So catch
> + # those errors, but also catch DeviceNotFoundError, which is the
> + # appropriate exception and which it may raise in future.
> + except (pyudev.DeviceNotFoundError, EnvironmentError, ValueError) as e:
> log.error("failed to update sysfs path for %s: %s", self.name, e)
> self.sysfsPath = ''
> else:
> --
> 1.9.3
Ack
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the anaconda-patches
mailing list