New (and I hope better) version of https://github.com/rhinstaller/anaconda/pull/140
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@redhat.com
Added label: rhel7-branch.
From: Vojtech Trefny vtrefny@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@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)
@@ -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)):
Please add a comment below this line that ``self.run()`` is actually "run the storage check". That would make things a lot clearer, I think.
Looks good to me other than the suggestion above.
Added label: ACK.
anaconda-patches@lists.fedorahosted.org