X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FDeleteNodeGroup.py;h=8bcee98b35d336a1709105bb190bfeef5b09f13c;hb=a040c4569c5d3aa73aa4166472ef256c8437be46;hp=d6de9b7877911f850919f49269b116681c9d1ddb;hpb=1f8c38dd1357c93e4be8d94456b7274a591d2db4;p=plcapi.git diff --git a/PLC/Methods/DeleteNodeGroup.py b/PLC/Methods/DeleteNodeGroup.py index d6de9b7..8bcee98 100644 --- a/PLC/Methods/DeleteNodeGroup.py +++ b/PLC/Methods/DeleteNodeGroup.py @@ -1,3 +1,4 @@ +# $Id$ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed @@ -18,19 +19,24 @@ class DeleteNodeGroup(Method): accepts = [ Auth(), Mixed(NodeGroup.fields['nodegroup_id'], - NodeGroup.fields['name']) + NodeGroup.fields['groupname']) ] returns = Parameter(int, '1 if successful') + def call(self, auth, node_group_id_or_name): # Get account information nodegroups = NodeGroups(self.api, [node_group_id_or_name]) if not nodegroups: raise PLCInvalidArgument, "No such node group" - nodegroup = nodegroups.values()[0] + nodegroup = nodegroups[0] nodegroup.delete() + # Logging variables + self.event_objects = {'NodeGroup': [nodegroup['nodegroup_id']]} + self.message = 'Node group %d deleted' % nodegroup['nodegroup_id'] + return 1