This patch fixes 2 things, which together fix tracebacks on an usb cardreader with no card present 1) Add a check to format.disklabel() for no media being present 2) _ped.DeviceException was changed to _ped.IOException for no media present errors in current pyparted --- storage/devices.py | 2 +- storage/formats/disklabel.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/storage/devices.py b/storage/devices.py index e473ca1..2259fb6 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -476,7 +476,7 @@ class StorageDevice(Device): # to find a device. try: self._partedDevice = parted.Device(path=self.path) - except _ped.DeviceException: + except _ped.IOException: pass return self._partedDevice diff --git a/storage/formats/disklabel.py b/storage/formats/disklabel.py index 8a653f0..a387c56 100644 --- a/storage/formats/disklabel.py +++ b/storage/formats/disklabel.py @@ -63,7 +63,7 @@ class DiskLabel(DeviceFormat): self._partedDisk = None self._origPartedDisk = None - if self.device: + if self.partedDevice: # set up the parted objects and raise exception on failure self._origPartedDisk = self.partedDisk.duplicate() @@ -119,7 +119,14 @@ class DiskLabel(DeviceFormat): def partedDevice(self): if not self._partedDevice and self.device and \ os.path.exists(self.device): - self._partedDevice = parted.Device(path=self.device) + # 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: + self._partedDevice = parted.Device(path=self.device) + except _ped.IOException: + pass return self._partedDevice -- 1.6.4 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list