Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS (http://www.linux-archive.org/centos/)
-   -   Make sure we return something other than None for new requests. (http://www.linux-archive.org/centos/262816-make-sure-we-return-something-other-than-none-new-requests.html)

David Lehman 03-13-2009 05:43 PM

Make sure we return something other than None for new requests.
 
---
storage/devices.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index d236d15..ed997e8 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -166,11 +166,20 @@ def PartitionDeviceFactory(*args, **kwargs):
norm_name = args[0].split("/")[-1]

# We look for the disk in /dev. From PartitionDevice its the [0] one.
- if (not kwargs.has_key("parents")) or
- (kwargs.has_key("exists") and not kwargs["exists"]):
+ if not kwargs.get("exists") and not kwargs.get("parents"):
# Cant really choose a good type of class, default to PartitionDevice
# This will be considered as a request.
return PartitionDevice(*args, **kwargs)
+ elif not kwargs.get("exists"):
+ # some requests have a disk specified
+ parents = kwargs["parents"]
+ if isinstance(parents, Device):
+ parents = [parents]
+
+ if isinstance(parents[0], DMRaidArrayDevice):
+ return DMRaidPartitionDevice(*args, **kwargs)
+ else:
+ return PartitionDevice(*args, **kwargs)
else:
parents = kwargs["parents"]
if isinstance(parents, Device):
--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Chris Lumens 03-13-2009 07:48 PM

Make sure we return something other than None for new requests.
 
> storage/devices.py | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/storage/devices.py b/storage/devices.py
> index d236d15..ed997e8 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -166,11 +166,20 @@ def PartitionDeviceFactory(*args, **kwargs):
> norm_name = args[0].split("/")[-1]
>
> # We look for the disk in /dev. From PartitionDevice its the [0] one.
> - if (not kwargs.has_key("parents")) or
> - (kwargs.has_key("exists") and not kwargs["exists"]):
> + if not kwargs.get("exists") and not kwargs.get("parents"):
> # Cant really choose a good type of class, default to PartitionDevice
> # This will be considered as a request.
> return PartitionDevice(*args, **kwargs)
> + elif not kwargs.get("exists"):
> + # some requests have a disk specified
> + parents = kwargs["parents"]
> + if isinstance(parents, Device):
> + parents = [parents]
> +
> + if isinstance(parents[0], DMRaidArrayDevice):
> + return DMRaidPartitionDevice(*args, **kwargs)
> + else:
> + return PartitionDevice(*args, **kwargs)
> else:
> parents = kwargs["parents"]
> if isinstance(parents, Device):

I noticed this today too, and it seems a little odd that it just started
showing up. No matter. This patch looks okay to me.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 07:59 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.