[blivet:rhel7/master 1/2] Verify that LUKS devices have some encryption key (#1023442)
mulhern
amulhern at redhat.com
Fri Jan 24 13:47:02 UTC 2014
Resolves: rhbz#1023442
This add a check that every non-existant LUKS device has some encryption
key to blivet.Blivet.sanityCheck.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/__init__.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 28bc8a4..3cb2187 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1444,6 +1444,22 @@ class Blivet(object):
return free
+ def _verifyLUKSDevicesHaveKey(self):
+ """Verify that all non-existant LUKS devices have some way of obtaining
+ a key.
+
+ Note: LUKS device creation will fail without a key.
+
+ :rtype: generator of str
+ :returns: a generator of error messages, may yield no error messages
+
+ """
+ for dev in [d for d in self.devices if \
+ d.format.type == "luks" and \
+ not d.format.exists and \
+ not d.format.hasKey]:
+ yield _("LUKS device %s has no encryption key") % (dev.name,)
+
def sanityCheck(self):
""" Run a series of tests to verify the storage configuration.
@@ -1626,6 +1642,8 @@ class Blivet(object):
if e:
errors.append(e)
+ errors += self._verifyLUKSDevicesHaveKey()
+
return (errors, warnings)
def isProtected(self, device):
--
1.8.3.1
More information about the anaconda-patches
mailing list