X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAdmAddNodeToNodeGroup.py;h=dc7eab4eab2a3740613b43919e0b128c701f9524;hb=a53ee9fc154268bdb4e7d014bba3bd0ac9477c9c;hp=419ef636dd71b6011648a0147845bc3981e65b48;hpb=bbd796a9d83ce1174c40acea7ad04c4a4fbf740b;p=plcapi.git diff --git a/PLC/Methods/AdmAddNodeToNodeGroup.py b/PLC/Methods/AdmAddNodeToNodeGroup.py index 419ef63..dc7eab4 100644 --- a/PLC/Methods/AdmAddNodeToNodeGroup.py +++ b/PLC/Methods/AdmAddNodeToNodeGroup.py @@ -1,46 +1,8 @@ -from PLC.Faults import * -from PLC.Method import Method -from PLC.Parameter import Parameter, Mixed -from PLC.NodeGroups import NodeGroup, NodeGroups -from PLC.Nodes import Node, Nodes -from PLC.Auth import PasswordAuth +from PLC.Methods.AddNodeToNodeGroup import AddNodeToNodeGroup -class AdmAddNodeToNodeGroup(Method): +class AdmAddNodeToNodeGroup(AddNodeToNodeGroup): """ - Add a node to the specified node group. If the node is - already a member of the nodegroup, no errors are returned. - - Returns 1 if successful, faults otherwise. + Deprecated. See AddNodeToNodeGroup. """ - roles = ['admin'] - - accepts = [ - PasswordAuth(), - Mixed(NodeGroup.fields['nodegroup_id'], - NodeGroup.fields['name']), - Mixed(Node.fields['node_id'], - Node.fields['hostname']) - ] - - returns = Parameter(int, '1 if successful') - - def call(self, auth, nodegroup_id_or_name, node_id_or_hostname): - # Get node info - nodes = Nodes(self.api, [node_id_or_hostname]) - if not nodes: - raise PLCInvalidArgument, "No such node" - node = nodes.values()[0] - - # Get nodegroup info - nodegroups = NodeGroups(self.api, [nodegroup_id_or_name]) - if not nodegroups: - raise PLCInvalidArgument, "No such nodegroup" - - nodegroup = nodegroups.values()[0] - - # add node to nodegroup - if node['node_id'] not in nodegroup['node_ids']: - nodegroup.add_node(node) - - return 1 + status = "deprecated"