New version of https://github.com/rhinstaller/anaconda/pull/174 for master. There are two new commits that were not in previous pull request: - don't raise KickstartValueError when parsing ks data in Anaconda - with autopart + encrypted, just mark the encrypt checkbox in the GUI selected
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.
Signed-off-by: Vojtech Trefny vtrefny@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:
From: Vojtech Trefny vtrefny@redhat.com
Anaconda will ask for the passphrase, raising exception here will cause kickstart data to be ignored.
Signed-off-by: Vojtech Trefny vtrefny@redhat.com --- pyanaconda/kickstart.py | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 7f9a0e0..31f3f38 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -1030,10 +1030,6 @@ def execute(self, storage, ksdata, instClass): # before this one to setup the storage.encryptionPassphrase self.passphrase = self.passphrase or storage.encryptionPassphrase
- if not self.passphrase: - raise KickstartValueError(formatErrorMsg(self.lineno, - msg=_("No passphrase given for encrypted LV"))) - cert = getEscrowCertificate(storage.escrowCertificates, self.escrowcert) if self.preexist: luksformat = fmt @@ -1360,10 +1356,6 @@ def execute(self, storage, ksdata, instClass): # before this one to setup the storage.encryptionPassphrase self.passphrase = self.passphrase or storage.encryptionPassphrase
- if not self.passphrase: - raise KickstartValueError(formatErrorMsg(self.lineno, - msg=_("No passphrase given for encrypted part"))) - cert = getEscrowCertificate(storage.escrowCertificates, self.escrowcert) if self.onPart: luksformat = kwargs["fmt"]
From: Vojtech Trefny vtrefny@redhat.com
Signed-off-by: Vojtech Trefny vtrefny@redhat.com --- pyanaconda/ui/gui/spokes/storage.py | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py index 6e14708..0f2b384 100644 --- a/pyanaconda/ui/gui/spokes/storage.py +++ b/pyanaconda/ui/gui/spokes/storage.py @@ -529,6 +529,10 @@ def refresh(self): name = overview.get_property("name") overview.set_chosen(name in self.selected_disks)
+ # if encrypted is specified in kickstart, select the encryptionCheckbox in the GUI + if self.encrypted: + self._encrypted.set_active(True) + self._customPart.set_active(not self.autopart)
self._update_summary()
These all look good to me.
Added label: ACK.
Closed.
Forgot to close this, already pushed two weeks ago.
anaconda-patches@lists.fedorahosted.org