[master 19/30] Try using the global LUKS passphrase if none is given for LV/part (#1196112)

KosiehBarter installerbot-noreply at redhat.com
Thu Jul 16 12:00:43 UTC 2015


From: Vratislav Podzimek <vpodzime at redhat.com>

If passphrase cannot be determined, raise an explanatory exception instead of
creating a LUKS device with no passhprase and leaving to error out somewhere
deep in Blivet.
---
 pyanaconda/kickstart.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 28d5be9..b64bd09 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1019,6 +1019,15 @@ def execute(self, storage, ksdata, instClass):
             if self.passphrase and not storage.encryptionPassphrase:
                 storage.encryptionPassphrase = self.passphrase
 
+            # try to use the global passphrase if available
+            # XXX: we require the LV/part with --passphrase to be processed
+            # 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
@@ -1332,6 +1341,15 @@ def execute(self, storage, ksdata, instClass):
             if self.passphrase and not storage.encryptionPassphrase:
                 storage.encryptionPassphrase = self.passphrase
 
+            # try to use the global passphrase if available
+            # XXX: we require the LV/part with --passphrase to be processed
+            # 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"]


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


More information about the anaconda-patches mailing list