[PATCH] Move _verifyLUKSDevicesHaveKey to Anaconda's codebase

Anne Mulhern amulhern at redhat.com
Thu Jul 31 11:00:43 UTC 2014





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Wednesday, July 30, 2014 1:44:29 PM
> Subject: [PATCH] Move _verifyLUKSDevicesHaveKey to Anaconda's codebase
> 
> It's only used by sanity checking moved in commit
> c51e1eb4b280d299e4aa20df429a4754587d10a8.
> 
> Also tweak its name to fit in the coding style on the way.
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  pyanaconda/storage_utils.py | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/pyanaconda/storage_utils.py b/pyanaconda/storage_utils.py
> index 1d3bf5e..329976e 100644
> --- a/pyanaconda/storage_utils.py
> +++ b/pyanaconda/storage_utils.py
> @@ -314,7 +314,25 @@ def sanity_check(storage, min_ram=isys.MIN_RAM):
>          if e:
>              exns.append(SanityError(e))
>  
> -    exns += storage._verifyLUKSDevicesHaveKey()
> +    exns += verify_LUKS_devices_have_key(storage)
>  
>      return exns
>  
> +
> +def verify_LUKS_devices_have_key(storage):
> +    """
> +    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 storage.devices if \
> +       d.format.type == "luks" and \
> +       not d.format.exists and \
> +       not d.format.hasKey):
> +        yield LUKSDeviceWithoutKeyError(_("LUKS device %s has no encryption
> key") % (dev.name,))
> --
> 1.9.3
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

And Ack.

- mulhern


More information about the anaconda-patches mailing list