3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.Auth import Auth
7 from PLC.NodeGroups import NodeGroup, NodeGroups
9 class DeleteNodeGroup(Method):
11 Delete an existing Node Group.
13 ins may delete any node group
15 Returns 1 if successful, faults otherwise.
22 Mixed(NodeGroup.fields['nodegroup_id'],
23 NodeGroup.fields['groupname'])
26 returns = Parameter(int, '1 if successful')
29 def call(self, auth, node_group_id_or_name):
30 # Get account information
31 nodegroups = NodeGroups(self.api, [node_group_id_or_name])
33 raise PLCInvalidArgument, "No such node group"
35 nodegroup = nodegroups[0]
40 self.event_objects = {'NodeGroup': [nodegroup['nodegroup_id']]}
41 self.message = 'Node group %d deleted' % nodegroup['nodegroup_id']