[blivet 05/13] Raise ValueError in BTRFS constructor if no parents specified.

Chris Lumens clumens at redhat.com
Fri Dec 6 16:57:58 UTC 2013


> diff --git a/blivet/devices.py b/blivet/devices.py
> index f8bc836..fe3bb1c 100644
> --- a/blivet/devices.py
> +++ b/blivet/devices.py
> @@ -4252,6 +4252,9 @@ class BTRFSDevice(StorageDevice):
>          if not args or not args[0]:
>              args = ("btrfs.%d" % Device._id,)
>  
> +        if "parents" not in kwargs or kwargs["parents"] is None:
> +            raise ValueError("BTRFSDevice must have at least one parent")
> +
>          self.req_size = kwargs.pop("size", None)
>          super(BTRFSDevice, self).__init__(*args, **kwargs)

The following would be an equivalent piece of python for this test:

    if kwargs.get("parents") is None:
        ...

- Chris


More information about the anaconda-patches mailing list