[rhel7-branch 1/1] Ask for encryption passphrase when not specified in ks (#1185466)

vojtechtrefny installerbot-noreply at redhat.com
Wed Jul 1 08:03:27 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.

Resolves: rhbz#1185466

Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>
---
 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 c681636..2321384 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -238,6 +238,8 @@ def __init__(self, *args, **kwargs):
         self.passphrase = ""
         self.selected_disks = self.data.ignoredisk.onlyuse[:]
 
+        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
         # there should be no need to modify this list.
@@ -276,15 +278,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
@@ -310,6 +314,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:
@@ -330,7 +340,7 @@ 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)):
                 self.run()
         finally:
             resetCustomStorageData(self.data)
@@ -755,6 +765,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
+
         # make sure the snapshot of unmodified on-disk-storage model is created
         if not on_disk_storage.created:
             on_disk_storage.create_snapshot(self.storage)


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


More information about the anaconda-patches mailing list