On Fri, 2011-06-17 at 16:56 +0200, Ales Kozumplik wrote: > Resolves: rhbz#689520 > --- > installinterfacebase.py | 11 +++++++++++ > storage/__init__.py | 13 +++++++++++-- > storage/devices.py | 2 +- > storage/errors.py | 4 +++- > 4 files changed, 26 insertions(+), 4 deletions(-) I'm not sure how I feel about this. It could be useful, particularly if there are/were other cases to fold in. I have reservations about how useful it will end up being, but it's such a small amount of code that it's hard to argue too hard against it if the code is clear/clean enough. It would be nice if the exception list and the check for hardware-specific failure were made less specific. Also, it might be nice to add it to Storage.reset instead of adding a new method. Of course, this may cause it to end up a large enough amount of code to become more objectionable. Hell, I don't know. Dave > > diff --git a/installinterfacebase.py b/installinterfacebase.py > index 71cb9cb..6d4dd11 100644 > --- a/installinterfacebase.py > +++ b/installinterfacebase.py > @@ -97,3 +97,14 @@ class InstallInterfaceBase(object): > custom_icon=icon, > custom_buttons=buttons, > expanded=True) > + > + def hardwareError(self, exception): > + text=_("The installation was stopped due to what seems to be a problem " > + "with your hardware, the exact error message is:\n\n%s.\n\n " > + "The installer will now terminate.") % str(exception) > + self.messageWindow(title=_("Hardware Error Encountered"), > + text=text, > + type="custom", > + custom_icon="error", > + custom_buttons=[_("_Exit installer")]) > + sys.exit(0) > diff --git a/storage/__init__.py b/storage/__init__.py > index 007f029..3c847f9 100644 > --- a/storage/__init__.py > +++ b/storage/__init__.py > @@ -87,7 +87,7 @@ def storageInitialize(anaconda): > # Set up the protected partitions list now. > if anaconda.protected: > storage.protectedDevSpecs.extend(anaconda.protected) > - storage.reset() > + storage.reset_checked(anaconda.intf) > > if not flags.livecdInstall and not storage.protectedDevices: > if anaconda.id.getUpgrade(): > @@ -100,7 +100,7 @@ def storageInitialize(anaconda): > type="custom", custom_buttons = [_("_Exit installer")]) > sys.exit(1) > else: > - storage.reset() > + storage.reset_checked(anaconda.intf) > > if not storage.disks: > rc = anaconda.intf.messageWindow(_("No disks found"), > @@ -435,6 +435,15 @@ class Storage(object): > self.dumpState("initial") > w.pop() > > + def reset_checked(self, intf): > + try: > + self.reset() > + except MPathError as e: > + if e.hardware_fault: > + intf.hardwareError(e) > + else: > + raise > + > @property > def devices(self): > """ A list of all the devices in the device tree. """ > diff --git a/storage/devices.py b/storage/devices.py > index a89de06..88741c1 100644 > --- a/storage/devices.py > +++ b/storage/devices.py > @@ -3382,7 +3382,7 @@ class MultipathDevice(DMDevice): > stderr = "/dev/tty5") > if rc: > raise MPathError("multipath activation failed for '%s'" % > - self.name) > + self.name, hardware_fault=True) > udev_settle() > self.setupPartitions() > udev_settle() > diff --git a/storage/errors.py b/storage/errors.py > index 1d1fea0..81e8a68 100644 > --- a/storage/errors.py > +++ b/storage/errors.py > @@ -126,7 +126,9 @@ class CryptoError(StorageError): > pass > > class MPathError(StorageError): > - pass > + def __init__(self, msg, hardware_fault=False): > + super(MPathError, self).__init__(msg) > + self.hardware_fault = hardware_fault > > # DeviceTree > class DeviceTreeError(StorageError): _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list