[master 1/3] Ask for encryption passphrase when not specified in ks (#1213096)

vojtechtrefny installerbot-noreply at redhat.com
Tue Jul 21 11:04:19 UTC 2015


From: Vojtech Trefny <vtrefny at redhat.com>

Kickstart installation fails when '--encrypted' is used without
specifying '--passphrase'. This patch marks the storage spoke as
unready and asks for a passphrase.

Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>

(cherry picked from commit ca7808df44482caa6f24cb20ae09aca33194ea8d)
---
 pyanaconda/ui/gui/spokes/storage.py | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 7088e5c..6e14708 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -257,6 +257,7 @@ def __init__(self, *args, **kwargs):
         self.passphrase = ""
         self.selected_disks = self.data.ignoredisk.onlyuse[:]
         self._back_clicked = False
+        self.autopart_missing_passphrase = False
 
         # This list contains all possible disks that can be included in the install.
         # All types of advanced disks should be set up for us ahead of time, so
@@ -295,15 +296,17 @@ def apply(self):
         self.data.autopart.encrypted = self.encrypted
         self.data.autopart.passphrase = self.passphrase
 
-        self.clearPartType = CLEARPART_TYPE_NONE
-
         if self.data.bootloader.bootDrive and \
            self.data.bootloader.bootDrive not in self.selected_disks:
             self.data.bootloader.bootDrive = ""
             self.storage.bootloader.reset()
 
         self.data.clearpart.initAll = True
-        self.data.clearpart.type = self.clearPartType
+
+        if not self.autopart_missing_passphrase:
+            self.clearPartType = CLEARPART_TYPE_NONE
+            self.data.clearpart.type = self.clearPartType
+
         self.storage.config.update(self.data)
         self.storage.autoPartType = self.data.autopart.type
         self.storage.encryptedAutoPart = self.data.autopart.encrypted
@@ -329,6 +332,12 @@ def _doExecute(self):
         # on the off-chance dasdfmt is running, we can't proceed further
         threadMgr.wait(constants.THREAD_DASDFMT)
         hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
+        if flags.automatedInstall and self.data.autopart.encrypted and not self.data.autopart.passphrase:
+            self.autopart_missing_passphrase = True
+            StorageChecker.errors = [_("Passphrase for autopart encryption not specified.")]
+            self._ready = True
+            hubQ.send_ready(self.__class__.__name__, True)
+            return
         try:
             doKickstartStorage(self.storage, self.data, self.instclass)
         except (StorageError, KickstartValueError) as e:
@@ -349,7 +358,8 @@ def _doExecute(self):
             hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
             self.data.bootloader.bootDrive = ""
         else:
-            if self.autopart:
+            if self.autopart or (flags.automatedInstall and (self.data.autopart.autopart or self.data.partition.seen)):
+                # run() executes StorageChecker.checkStorage in a seperate threat
                 self.run()
         finally:
             resetCustomStorageData(self.data)
@@ -743,6 +753,11 @@ def on_back_clicked(self, button):
         # user might want to change settings presented in the dialogs shown from
         # within this method.
 
+        if self.autopart_missing_passphrase:
+            self._check_encrypted()
+            NormalSpoke.on_back_clicked(self, button)
+            return
+
         # Do not enter this method multiple times if user clicking multiple times
         # on back button
         if self._back_clicked:


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


More information about the anaconda-patches mailing list