Support placement lists (#103)
authorCory Johns <johnsca@gmail.com>
Mon, 3 Apr 2017 21:26:47 +0000 (17:26 -0400)
committerGitHub <noreply@github.com>
Mon, 3 Apr 2017 21:26:47 +0000 (17:26 -0400)
juju/placement.py

index 5ee9ba6..d0d42f7 100644 (file)
@@ -22,7 +22,13 @@ def parse(directive):
         # Handle null case
         return None
 
-    if type(directive) in [dict, client.Placement]:
+    if isinstance(directive, (list, tuple)):
+        results = []
+        for d in directive:
+            results.extend(parse(d))
+        return results
+
+    if isinstance(directive, (dict, client.Placement)):
         # We've been handed something that we can simply hand back to
         # the api. (Forwards compatibility)
         return [directive]