[master 1/4] Add handling for unusable storage configurations.

dwlehman installerbot-noreply at redhat.com
Fri Apr 10 20:05:03 UTC 2015


From: David Lehman <dlehman at redhat.com>

Show an error message and offer to retry or quit. The user can go to the
shell on buffer 2, resolve the issue, then return to the installer, retry
and continue.

Related: rhbz#1158475
---
 pyanaconda/errors.py    | 26 ++++++++++++++++++++++++++
 pyanaconda/exception.py |  2 ++
 2 files changed, 28 insertions(+)

diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
index 72c4488..4ca7fb3 100644
--- a/pyanaconda/errors.py
+++ b/pyanaconda/errors.py
@@ -25,6 +25,12 @@
            "MediaMountError", "ScriptError", "CmdlineError",
            "errorHandler"]
 
+# Only run the pango markup escape if the GUI is available
+try:
+    from pyanaconda.ui.gui.utils import escape_markup
+except ImportError:
+    escape_markup = lambda x: x
+
 class InvalidImageSizeError(Exception):
     def __init__(self, message, filename):
         Exception.__init__(self, message)
@@ -120,6 +126,22 @@ def _fsResizeHandler(self, exn):
         self.ui.showError(message)
         return ERROR_RAISE
 
+    def _storageResetHandler(self, exn):
+        message = (_("There is a problem with your existing storage "
+                     "configuration: <b>%(errortxt)s</b>\n\n"
+                     "You must resolve this matter before the installation can "
+                     "proceed. There is a shell available for use which you "
+                     "can access by pressing ctrl-alt-f1 and then ctrl-b 2."
+                     "\n\nOnce you have resolved the issue you can retry the "
+                     "storage scan. If you do not fix it you will have to exit "
+                     "the installer.") % {"errortxt": escape_markup(exn.message)})
+        details = _(exn.suggestion)
+        buttons = (_("_Exit Installer"), _("_Retry"))
+        if self.ui.showDetailedError(message, details, buttons=buttons):
+            return ERROR_RETRY
+        else:
+            return ERROR_RAISE
+
     def _noDisksHandler(self, exn):
         message = _("An error has occurred - no valid devices were found on "
                     "which to create new file systems.  Please check your "
@@ -284,6 +306,10 @@ def cb(self, exn):
 
         _map = {"PartitioningError": self._partitionErrorHandler,
                 "FSResizeError": self._fsResizeHandler,
+                "UnusableConfigurationError": self._storageResetHandler,
+                "DiskLabelScanError": self._storageResetHandler,
+                "CorruptGPTError": self._storageResetHandler,
+                "DuplicateVGError": self._storageResetHandler,
                 "NoDisksError": self._noDisksHandler,
                 "FSTabTypeMismatchError": self._fstabTypeMismatchHandler,
                 "InvalidImageSizeError": self._invalidImageSizeHandler,
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 05735bc..977c52d 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -82,6 +82,8 @@ def _main_loop_handleException(self, dump_info):
                              "The installer will now terminate.") % str(value)
             self.intf.messageWindow(_("Hardware error occured"), hw_error_msg)
             sys.exit(0)
+        elif isinstance(value, blivet.errors.UnusableConfigurationError):
+            sys.exit(0)
         else:
             super(AnacondaExceptionHandler, self).handleException(dump_info)
             return False


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/9d3533a7c90d89385ab8a8f589ff9ad4a989e873


More information about the anaconda-patches mailing list