[blivet:rhel7/master] Don't add None value to req_disks (#981316)

Vratislav Podzimek vpodzime at redhat.com
Mon Feb 3 08:35:51 UTC 2014


On Fri, 2014-01-31 at 13:02 -0500, mulhern wrote:
> Resolves: rhbz#981316
> 
> If a disk has been removed in the interim it won't be found by a lookup
> in the device tree, but we don't want to include None in our copy.
> 
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
>  blivet/__init__.py | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/blivet/__init__.py b/blivet/__init__.py
> index 1f6637f..1236511 100644
> --- a/blivet/__init__.py
> +++ b/blivet/__init__.py
> @@ -1961,11 +1961,8 @@ class Blivet(object):
>                  continue
>  
>              # update the refs in req_disks as well
> -            req_disks = []
> -            for disk in partition.req_disks:
> -                req_disks.append(new.devicetree.getDeviceByID(disk.id))
> -
> -            partition.req_disks = req_disks
> +            req_disks = (new.devicetree.getDeviceByID(disk.id) for disk in partition.req_disks)
> +            partition.req_disks = [disk for disk in req_disks if disk is not None]
>  
>              p = partition.disk.format.partedDisk.getPartitionByPath(partition.path)
>              partition.partedPartition = p
Good fix, neat code. ACK.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list