This commit was manufactured by cvs2svn to create branch
[plcapi.git] / PLC / Methods / DeleteNodeGroup.py
index cf6dd8a..7606607 100644 (file)
@@ -1,7 +1,7 @@
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
 from PLC.NodeGroups import NodeGroup, NodeGroups
 
 class DeleteNodeGroup(Method):
@@ -16,21 +16,26 @@ class DeleteNodeGroup(Method):
     roles = ['admin']
 
     accepts = [
-        PasswordAuth(),
+        Auth(),
         Mixed(NodeGroup.fields['nodegroup_id'],
              NodeGroup.fields['name'])
         ]
 
     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.object_ids = [nodegroup['nodegroup_id']]
+       self.message  = 'Node group %d deleted' % nodegroup['nodegroup_id']
         return 1