From 4f6dc179a6b1180166288af04cd7c2f74507eaca Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 20 Sep 2006 17:26:11 +0000 Subject: [PATCH] - remove extraneous code - fix accepts --- PLC/Methods/AdmAddNodeGroup.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/PLC/Methods/AdmAddNodeGroup.py b/PLC/Methods/AdmAddNodeGroup.py index 3468cf1b..88efa7ac 100644 --- a/PLC/Methods/AdmAddNodeGroup.py +++ b/PLC/Methods/AdmAddNodeGroup.py @@ -1,10 +1,7 @@ - from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed -from PLC.Nodes import Node, Nodes from PLC.NodeGroups import NodeGroup, NodeGroups -#from PLC.Sites import Site, Sites from PLC.Auth import PasswordAuth class AdmAddNodeGroup(Method): @@ -17,27 +14,17 @@ class AdmAddNodeGroup(Method): roles = ['admin'] - can_update = lambda (field, value): field in \ - ['name', 'description', 'is_custom'] - update_fields = dict(filter(can_update, NodeGroup.fields.items())) - accepts = [ PasswordAuth(), NodeGroup.fields['name'], - NodeGroup.fields['description'], - update_fields + NodeGroup.fields['description'] ] returns = Parameter(int, 'New nodegroup_id (> 0) if successful') - def call(self, auth, name, description, optional_vals = {}): - if filter(lambda field: field not in self.update_fields, optional_vals): - raise PLCInvalidArgument, "Invalid fields specified" - + def call(self, auth, name, description): # Create node group - node_group = NodeGroup(self.api, optional_vals) - node_group['name'] = name - node_group['description'] = description - node_group.flush() + nodegroup = NodeGroup(self.api, {'name': name, 'description': description}) + nodegroup.flush() - return node_group['nodegroup_id'] + return nodegroup['nodegroup_id'] -- 2.47.0