[PATCH 01/13] Add encrypted attribute to StorageDevice.

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

 



This attribute is True if the device, or any of the devices it is built
on, is encrypted.
---
 pyanaconda/platform.py        |    9 ++-------
 pyanaconda/storage/devices.py |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index 6004c92..1105b05 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -138,14 +138,9 @@ class Platform(object):
            req.format.type not in self.bootFSTypes:
             errors.append(_("The /boot filesystem cannot be of type %s.") % req.format.type)
 
-        if req.type == "luks/dm-crypt":
-            # Handle encrypted boot on a partition.
+        if req.encrypted:
+            # Handle /boot that is, or depends on devices that are, encrypted
             errors.append(_("The /boot filesystem cannot be on an encrypted block device"))
-        else:
-            # Handle encrypted boot on more complicated devices.
-            for dev in filter(lambda d: d.type == "luks/dm-crypt", self.anaconda.storage.devices):
-                if req in self.anaconda.storage.deviceDeps(dev):
-                    errors.append(_("The /boot filesystem cannot be on an encrypted block device"))
 
         errors.extend(self.checkDiskLabel(req))
         return errors
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index b2d6dd8..d450a26 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -528,6 +528,20 @@ class StorageDevice(Device):
         return _disks
 
     @property
+    def encrypted(self):
+        """ True if this device, or any it requires, is encrypted. """
+        crypted = False
+        for parent in self.parents:
+            if parent.encrypted:
+                crypted = True
+                break
+
+        if not crypted and isinstance(self, DMCryptDevice):
+            crypted = True
+
+        return crypted
+
+    @property
     def partedDevice(self):
         if self.exists and self.status and not self._partedDevice:
             log.debug("looking up parted Device: %s" % self.path)
-- 
1.7.3.4

_______________________________________________
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