X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FSliceNodesList.py;h=1c74168e76f43899f1fd9a792467af76bdf0e282;hb=bd0cbf4f7f2e4cf7ceda500bfa6f98c0a700018b;hp=81cdff413910ee3249ed12bc45052e0c2c12a157;hpb=bc15dc8096f4465bb8c3e9da2177b010828fe5b5;p=plcapi.git diff --git a/PLC/Methods/SliceNodesList.py b/PLC/Methods/SliceNodesList.py index 81cdff4..1c74168 100644 --- a/PLC/Methods/SliceNodesList.py +++ b/PLC/Methods/SliceNodesList.py @@ -5,13 +5,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.Methods.GetNodes import GetNodes -class SliceNodesList(Method): +class SliceNodesList(GetSlices, GetNodes): """ - Deprecated. Can be implemented with GetSlices. + Deprecated. Can be implemented with GetSlices and GetNodes. """ - + status = "deprecated" roles = ['admin', 'pi', 'user'] @@ -22,17 +23,18 @@ class SliceNodesList(Method): ] returns = [Node.fields['hostname']] - + def call(self, auth, slice_name): - # If we are not admin, make sure to return only viewable - # slices. - slices = GetSlices(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