From f450c44293c8d5fa6abc28bb0fd9fed43784cbea Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Jul 23 2015 07:40:08 +0000 Subject: Ask for encryption passphrase when not specified in ks (#1213096) 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 (cherry picked from commit ca7808df44482caa6f24cb20ae09aca33194ea8d) --- 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 @@ class StorageSpoke(NormalSpoke, StorageChecker): 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 @@ class StorageSpoke(NormalSpoke, StorageChecker): 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 @@ class StorageSpoke(NormalSpoke, StorageChecker): # 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 @@ class StorageSpoke(NormalSpoke, StorageChecker): 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 @@ class StorageSpoke(NormalSpoke, StorageChecker): # 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: