1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.NodeGroups import NodeGroup, NodeGroups
5 from PLC.Auth import PasswordAuth
7 can_update = lambda (field, value): field in \
10 class AddNodeGroup(Method):
12 Adds a new node group. Any values specified in nodegroup_fields
13 are used, otherwise defaults are used.
15 Returns the new nodegroup_id (> 0) if successful, faults otherwise.
20 update_fields = dict(filter(can_update, NodeGroup.fields.items()))
24 NodeGroup.fields['name'],
28 returns = Parameter(int, 'New nodegroup_id (> 0) if successful')
31 object_type = 'NodeGroup'
34 def call(self, auth, name, nodegroup_fields = {}):
35 nodegroup_fields = dict(filter(can_update, nodegroup_fields.items()))
36 nodegroup = NodeGroup(self.api, nodegroup_fields)
37 nodegroup['name'] = name
39 self.object_ids = [nodegroup['nodegroup_id']]
41 return nodegroup['nodegroup_id']