compatibility mode, support for 2 ends running different api releases
[plcapi.git] / PLC / Methods / SliceNodesList.py
index fd61b65..f7a739d 100644 (file)
@@ -1,3 +1,5 @@
+# $Id$
+# $URL$
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Filter import Filter
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Filter import Filter
@@ -5,13 +7,14 @@ from PLC.Auth import Auth
 from PLC.Slices import Slice, Slices
 from PLC.Nodes import Node, Nodes
 from PLC.Methods.GetSlices import GetSlices
 from PLC.Slices import Slice, Slices
 from PLC.Nodes import Node, Nodes
 from PLC.Methods.GetSlices import GetSlices
+from PLC.Methods.GetNodes import GetNodes
 
 
-class SliceNodesList(GetSlices):
+class SliceNodesList(GetSlices, GetNodes):
     """
     """
-    Deprecated. Can be implemented with GetSlices.
+    Deprecated. Can be implemented with GetSlices and GetNodes.
 
     """
 
     """
-  
+
     status = "deprecated"
 
     roles = ['admin', 'pi', 'user']
     status = "deprecated"
 
     roles = ['admin', 'pi', 'user']
@@ -22,15 +25,18 @@ class SliceNodesList(GetSlices):
         ]
 
     returns = [Node.fields['hostname']]
         ]
 
     returns = [Node.fields['hostname']]
-    
+
 
     def call(self, auth, slice_name):
 
     def call(self, auth, slice_name):
-       slices = GetSlices.call(self, auth, [slice_name])
-       slice = slices[0]
-       nodes = Nodes(self.api, slice['node_ids'])
-       if not nodes:
-           return []
-       
-       node_hostnames = [node['hostname'] for node in nodes]           
-       
+        slices = GetSlices.call(self, auth, [slice_name])
+        if not slices:
+            return []
+
+        slice = slices[0]
+        nodes = GetNodes.call(self, auth, slice['node_ids'])
+        if not nodes:
+            return []
+
+        node_hostnames = [node['hostname'] for node in nodes]
+
         return node_hostnames
         return node_hostnames