--- pyanaconda/storage/__init__.py | 7 +++++++ pyanaconda/storage/devicetree.py | 2 +- pyanaconda/ui/gui/spokes/custom.py | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index 67979eb..0726a1c 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -1400,6 +1400,13 @@ class Storage(object):
return name
+ 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._DeviceTree__luksDevs[device.format.uuid] = passphrase + self.devicetree._DeviceTree__passphrases.append(passphrase) + def doEncryptionPassphraseRetrofits(self): """ Add the global passphrase to all preexisting LUKS devices.
diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py index 9450ee0..85d5c61 100644 --- a/pyanaconda/storage/devicetree.py +++ b/pyanaconda/storage/devicetree.py @@ -1165,7 +1165,7 @@ class DeviceTree(object): device.format.passphrase = 'yabbadabbadoo' else: # Try each known passphrase. - for passphrase in self.__luksDevs.values(): + for passphrase in self.__passphrases: device.format.passphrase = passphrase try: device.format.setup() diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 049d484..55dd4c3 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -393,6 +393,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): parents=[slave], exists=True) luks_device.setup() + self.storage.savePassphrase(slave) self.storage.devicetree._addDevice(luks_device)
# XXX What if the user has changed storage config in the shell? @@ -2018,8 +2019,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): exists=True) self.__storage.devicetree._addDevice(luks_dev) # save the passphrase for possible reset and to try for other devs - self.__storage._Storage__luksDevs[device.format.uuid] = passphrase - self.__storage.devicetree._DeviceTree__luksDevs[device.format.uuid] = passphrase + self.__storage.savePassphrase(device) # XXX What if the user has changed things using the shell? self.__storage.devicetree.populate() # look for new roots