diff options
author | David Lehman <dlehman@redhat.com> | 2009-03-13 13:43:01 -0500 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2009-03-13 17:15:20 -0500 |
commit | cd33f1451475dab853bc0021704257e5b1ac6879 (patch) | |
tree | 543fe5a32129b2e0c1f337f583df1d27a02fafde | |
parent | 7531edf4c208d1f807fbe629575848cfade5c927 (diff) | |
download | anaconda-cd33f1451475dab853bc0021704257e5b1ac6879.tar.gz anaconda-cd33f1451475dab853bc0021704257e5b1ac6879.tar.xz anaconda-cd33f1451475dab853bc0021704257e5b1ac6879.zip |
Make sure we return something other than None for new requests.
-rw-r--r-- | storage/devices.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/storage/devices.py b/storage/devices.py index b3f7d2917..fffebca84 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): |