[anaconda:rhel7/master 5/8] Do not consider no available LUKS passphrase an error in do_autopart (#1060255)

mulhern amulhern at redhat.com
Fri Feb 7 15:00:34 UTC 2014


Resolves: rhbz#1060255

doAutoPart no longer runs sanityCheck.

So, the new strategy is:
1) Run doAutoPart and catch any actual Errors.
2) When all that is done, run sanityCheck and deal with those errors.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 pyanaconda/ui/gui/spokes/custom.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index d878002..b15ef15 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -63,6 +63,7 @@ from blivet.errors import NoDisksError
 from blivet.errors import NotEnoughFreeSpaceError
 from blivet.errors import CryptoError
 from blivet.errors import MDRaidError
+from blivet.errors import LUKSDeviceWithoutKeyError
 from blivet.devicelibs import mdraid
 from blivet.devices import LUKSDevice
 
@@ -2627,7 +2628,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._removeButton.set_sensitive(True)
 
     def _do_autopart(self):
-        # There are never any non-existent devices around when this runs.
+        """Helper function for on_create_clicked.
+           Assumes a non-final context in which at least some errors
+           discovered by sanityCheck are not considered fatal because they
+           will be dealt with later.
+
+           Note: There are never any non-existent devices around when this runs.
+        """
         log.debug("running automatic partitioning")
         self.__storage.doAutoPart = True
         self.clear_errors()
@@ -2663,6 +2670,22 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                 self.__storage.doAutoPart = False
                 log.debug("finished automatic partitioning")
 
+            (errors, warnings) = self.__storage.sanityCheck()
+            errors = [error for error in errors if not isinstance(error, LUKSDeviceWithoutKeyError)]
+            for error in errors:
+                log.error(error.message)
+            for warning in warnings:
+                log.warning(warning.message)
+
+            if errors:
+                messages = "\n".join(error.message for error in errors)
+                log.error("doAutoPartition failed: %s" % messages)
+                self._reset_storage()
+                self._error = messages
+                self.set_error(_("Automatic partitioning failed. Click "
+                                 "for details."))
+                self.window.show_all()
+
     def on_create_clicked(self, button, autopartTypeCombo):
         # Then do autopartitioning.  We do not do any clearpart first.  This is
         # custom partitioning, so you have to make your own room.
-- 
1.8.3.1



More information about the anaconda-patches mailing list