[blivet:rhel7/master 1/2] Verify that LUKS devices have some encryption key (#1023442)

Vratislav Podzimek vpodzime at redhat.com
Fri Jan 24 16:22:26 UTC 2014


On Fri, 2014-01-24 at 08:47 -0500, mulhern wrote:
> 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]:
Just the last neatpick -- you can use parentheses instead of square
brackets to avoid creating an unnecessary temporary list and using a
generator expression instead. ACK with or without this change. Thanks!

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list