[master 1/1] Do not save None as passphrase for LUKS devices (#1269646)
vojtechtrefny
installerbot-noreply at redhat.com
Wed Oct 14 08:36:55 UTC 2015
From: Vojtech Trefny <vtrefny at redhat.com>
Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>
---
blivet/blivet.py | 8 ++++----
blivet/populator.py | 5 +++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/blivet/blivet.py b/blivet/blivet.py
index 4df8cf6..451ca97 100644
--- a/blivet/blivet.py
+++ b/blivet/blivet.py
@@ -256,7 +256,7 @@ def reset(self, cleanupOnly=False):
self.encryptionPassphrase = None
for device in self.devices:
if device.format.type == "luks" and device.format.exists:
- self.__luksDevs[device.format.uuid] = device.format._LUKS__passphrase
+ self.savePassphrase(device)
if self.ksdata:
self.config.update(self.ksdata)
@@ -1319,8 +1319,9 @@ def full_name(name, parent):
def savePassphrase(self, device):
""" Save a device's LUKS passphrase in case of reset. """
passphrase = device.format._LUKS__passphrase
- self.__luksDevs[device.format.uuid] = passphrase
- self.devicetree.saveLUKSpassphrase(device)
+ if passphrase:
+ self.__luksDevs[device.format.uuid] = passphrase
+ self.devicetree.saveLUKSpassphrase(device)
def setupDiskImages(self):
self.devicetree.setDiskImages(self.config.diskImages)
@@ -1883,4 +1884,3 @@ def setFstabSwaps(self, devices):
"""
self.fsset.setFstabSwaps(devices)
-
diff --git a/blivet/populator.py b/blivet/populator.py
index 81ae73e..733c593 100644
--- a/blivet/populator.py
+++ b/blivet/populator.py
@@ -1603,8 +1603,9 @@ def saveLUKSpassphrase(self, device):
""" Save a device's LUKS passphrase in case of reset. """
passphrase = device.format._LUKS__passphrase
- self.__luksDevs[device.format.uuid] = passphrase
- self.__passphrases.append(passphrase)
+ if passphrase:
+ self.__luksDevs[device.format.uuid] = passphrase
+ self.__passphrases.append(passphrase)
def populate(self, cleanupOnly=False):
""" Locate all storage devices.
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/c93b36f184e192a76b36a7ee6c5d65a998d6d15f
More information about the anaconda-patches
mailing list