[PATCH] Make sure we return something other than None for new requests.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux