From 9495234109f25369b48cb284c1a8858772ef32a8 Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 20 Sep 2006 14:41:48 +0000 Subject: [PATCH] - fix comments - remove unnecessary imports and assertions - naming nits --- PLC/Methods/AdmGetNodeGroupNodes.py | 32 +++++++++-------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/PLC/Methods/AdmGetNodeGroupNodes.py b/PLC/Methods/AdmGetNodeGroupNodes.py index b641662f..a82ed566 100644 --- a/PLC/Methods/AdmGetNodeGroupNodes.py +++ b/PLC/Methods/AdmGetNodeGroupNodes.py @@ -1,16 +1,12 @@ -import os - from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed -from PLC.Sites import Site, Sites -from PLC.Nodes import Node, Nodes from PLC.Auth import PasswordAuth from PLC.NodeGroups import NodeGroup, NodeGroups + class AdmGetNodeGroupNodes(Method): """ - Return a list of node_ids for the node group specified. - + Returns a list of node_ids for the node group specified. """ roles = ['admin', 'pi', 'user', 'tech'] @@ -21,24 +17,16 @@ class AdmGetNodeGroupNodes(Method): NodeGroup.fields['name']) ] - returns = [NodeGroup.join_fields['node_ids']] - + returns = NodeGroup.join_fields['node_ids'] def call(self, auth, nodegroup_id_or_name): - # Authenticated function - assert self.caller is not None - # Get nodes in this nodegroup - nodegroup = NodeGroups(self.api, [nodegroup_id_or_name]) + nodegroups = NodeGroups(self.api, [nodegroup_id_or_name]) + if not nodegroups: + raise PLCInvalidArgument, "No such node group" - # make sure nodegroup is found - if not nodegroup: - raise PLCInvalidArgument, "No such nodegroup" - - #get the info for the node group specified - nodegroup_values = nodegroup.values()[0] + # Get the info for the node group specified + nodegroup = nodegroups.values()[0] - #grab the list of node ides fromt the disctioary - node_ids = nodegroup_values['node_ids'] - - return node_ids + # Return the list of node_ids + return nodegroup['node_ids'] -- 2.47.0