[PATCH] Check for devices with no media present in filter_gui.py (#558177)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This stops us from backtracing on for example usb cardreaders without
a card in them.
---
 iw/filter_gui.py |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/iw/filter_gui.py b/iw/filter_gui.py
index 6145cd4..41e9be7 100644
--- a/iw/filter_gui.py
+++ b/iw/filter_gui.py
@@ -24,6 +24,7 @@ import gtk, gobject
 import gtk.glade
 import gui
 import parted
+import _ped
 from DeviceSelector import *
 from baseudev import *
 from constants import *
@@ -576,7 +577,14 @@ class FilterWindow(InstallWindow):
         for d in nonraids:
             name = udev_device_get_name(d)
 
-            partedDevice = parted.Device(path="/dev/" + name)
+            # We aren't guaranteed to be able to get a device.  In
+            # particular, built-in USB flash readers show up as devices but
+            # do not always have any media present, so parted won't be able
+            # to find a device.
+            try:
+                partedDevice = parted.Device(path="/dev/" + name)
+            except (_ped.IOException, _ped.DeviceException):
+                continue
             d["XXX_SIZE"] = int(partedDevice.getSize())
 
             # This isn't so great, but for iSCSI devices the path contains a lot
@@ -622,7 +630,10 @@ class FilterWindow(InstallWindow):
             # We only need to grab information from the first device in the set.
             name = udev_device_get_name(mpath[0])
 
-            partedDevice = parted.Device(path="/dev/" + name)
+            try:
+                partedDevice = parted.Device(path="/dev/" + name)
+            except (_ped.IOException, _ped.DeviceException):
+                continue
             mpath[0]["XXX_SIZE"] = int(partedDevice.getSize())
             model = partedDevice.model
 
-- 
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux