get rid of svn keywords once and for good
[plcapi.git] / PLC / Methods / SliceNodesList.py
1 from PLC.Method import Method
2 from PLC.Parameter import Parameter, Mixed
3 from PLC.Filter import Filter
4 from PLC.Auth import Auth
5 from PLC.Slices import Slice, Slices
6 from PLC.Nodes import Node, Nodes
7 from PLC.Methods.GetSlices import GetSlices
8 from PLC.Methods.GetNodes import GetNodes
9
10 class SliceNodesList(GetSlices, GetNodes):
11     """
12     Deprecated. Can be implemented with GetSlices and GetNodes.
13
14     """
15
16     status = "deprecated"
17
18     roles = ['admin', 'pi', 'user']
19
20     accepts = [
21         Auth(),
22         Slice.fields['name']
23         ]
24
25     returns = [Node.fields['hostname']]
26
27
28     def call(self, auth, slice_name):
29         slices = GetSlices.call(self, auth, [slice_name])
30         if not slices:
31             return []
32
33         slice = slices[0]
34         nodes = GetNodes.call(self, auth, slice['node_ids'])
35         if not nodes:
36             return []
37
38         node_hostnames = [node['hostname'] for node in nodes]
39
40         return node_hostnames