[PATCH 2/2] Fix handling of locked preexisting LUKS devices. (#502310)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix lookup of LUKS device for partitions to not traceback on failure
and allow reformat w/ encryption for all device types.
---
 iw/lvm_dialog_gui.py       |    3 ++-
 iw/partition_dialog_gui.py |    9 +++++++--
 iw/raid_dialog_gui.py      |    4 +++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 18e140a..e226650 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -691,7 +691,8 @@ class VolumeGroupEditor:
 
                 format = fmt_class(mountpoint=mountpoint)
                 if self.lukscb and self.lukscb.get_active() and \
-                   templv.format.type != "luks":
+                   (templv.format.type != "luks" or
+                    (templv.format.exists and not templv.format.hasKey)):
                     newluks = format
                     format = getFormat("luks",
                                        passphrase=self.storage.encryptionPassphrase)
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index e19b229..5980efc 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -215,7 +215,10 @@ class PartitionEditor:
                 # preexisting partition
                 request = self.origrequest
                 if request.format.type == "luks":
-                    usedev = self.storage.devicetree.getChildren(request)[0]
+                    try:
+                        usedev = self.storage.devicetree.getChildren(request)[0]
+                    except IndexError:
+                        usedev = request
                 else:
                     usedev = request
 
@@ -235,7 +238,9 @@ class PartitionEditor:
                         luksdev = None
                         if self.fsoptionsDict.has_key("lukscb") and \
                            self.fsoptionsDict["lukscb"].get_active() and \
-                           request.format.type != "luks":
+                           (request.format.type != "luks" or
+                            (request.format.exists and
+                             not request.format.hasKey)):
                             luksdev = LUKSDevice("luks%d" % self.storage.nextID,
                                                  format=format,
                                                  parents=request)
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 863400e..02a452e 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -234,7 +234,9 @@ class RaidEditor:
                     format = fmt_class(mountpoint=mountpoint)
                     if self.fsoptionsDict.has_key("lukscb") and \
                        self.fsoptionsDict["lukscb"].get_active() and \
-                       self.origrequest.format.type != "luks":
+                       (self.origrequest.format.type != "luks" or
+                        (self.origrequest.format.exists and
+                         not self.origrequest.format.hasKey)):
                         luksdev = LUKSDevice("luks-%s" % self.origrequest.name,
                                              format=format,
                                              parents=self.origrequest)
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux