X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAdmUpdateNodeGroup.py;h=b53198ac751cbeca8947b8aff8a27454c97736c1;hb=dec2f6cf93e4320722264e185ae8531c467c4692;hp=a659507386a61e27443786b6b44b306dffd9266f;hpb=559103ea50e1736d811bb92842dca35905813be5;p=plcapi.git diff --git a/PLC/Methods/AdmUpdateNodeGroup.py b/PLC/Methods/AdmUpdateNodeGroup.py index a659507..b53198a 100644 --- a/PLC/Methods/AdmUpdateNodeGroup.py +++ b/PLC/Methods/AdmUpdateNodeGroup.py @@ -2,20 +2,20 @@ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.NodeGroups import NodeGroup, NodeGroups -from PLC.Auth import PasswordAuth +from PLC.Auth import Auth +from PLC.Methods.UpdateNodeGroup import UpdateNodeGroup -class AdmUpdateNodeGroup(Method): +class AdmUpdateNodeGroup(UpdateNodeGroup): """ - Updates a custom node group. - - Returns 1 if successful, faults otherwise. + Deprecated. See UpdateNodeGroup. """ - roles = ['admin'] + status = "deprecated" accepts = [ - PasswordAuth(), - NodeGroup.fields['nodegroup_id'], + Auth(), + Mixed(NodeGroup.fields['nodegroup_id'], + NodeGroup.fields['name']), NodeGroup.fields['name'], NodeGroup.fields['description'] ] @@ -23,20 +23,5 @@ class AdmUpdateNodeGroup(Method): returns = Parameter(int, '1 if successful') def call(self, auth, nodegroup_id_or_name, name, description): - # Get nodegroup information - nodegroups = NodeGroups(self.api, [nodegroup_id_or_name]) - if not nodegroups: - raise PLCInvalidArgument, "No such nodegroup" - - nodegroup = nodegroups.values()[0] - - # Modify node group - update_fields = { - 'name': name, - 'description': description - } - - nodegroup.update(update_fields) - nodegroup.flush() - - return 1 + return UpdateNodeGroup.call(self, auth, nodegroup_id_or_name, + {'name': name, 'description': description})