[PATCH 2/2] Do not restrict MDRaidArrayDevice's memberDevices to type int

David Lehman dlehman at redhat.com
Fri Feb 27 14:49:47 UTC 2015


On 02/27/2015 08:17 AM, Vratislav Podzimek wrote:
> We may also get long from various places (e.g. libblockdev via GObject
> introspection).
>
> Also improve the confusing error message.
>
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>   blivet/devices/md.py | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/blivet/devices/md.py b/blivet/devices/md.py
> index 5c92c09..f020a39 100644
> --- a/blivet/devices/md.py
> +++ b/blivet/devices/md.py
> @@ -20,6 +20,7 @@
>   #
>
>   import os
> +import six
>
>   from gi.repository import BlockDev as blockdev
>   from gi.repository import GLib
> @@ -267,8 +268,8 @@ class MDRaidArrayDevice(ContainerDevice, RaidDevice):
>           return self._memberDevices
>
>       def _setMemberDevices(self, number):
> -        if not isinstance(number, int):
> -            raise ValueError("memberDevices is an integer")
> +        if not isinstance(number, six.integer_types):
> +            raise ValueError("memberDevices has to be an integer")

I would s/has to/must/, but that's all. Other than that these both look 
right to me.

David

>
>           if not self.exists and number > self.totalDevices:
>               raise ValueError("memberDevices cannot be greater than totalDevices")
>



More information about the anaconda-patches mailing list