From: Tony Mack Date: Thu, 21 Apr 2011 02:12:24 +0000 (-0400) Subject: add node tags as root not as caller X-Git-Tag: plcapi-5.0-33~5^2~3^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=795bc4250d3e357dd141cb541c8313e5de88e86f;p=plcapi.git add node tags as root not as caller --- diff --git a/PLC/Methods/UpdateNode.py b/PLC/Methods/UpdateNode.py index a74db92a..2927f73a 100644 --- a/PLC/Methods/UpdateNode.py +++ b/PLC/Methods/UpdateNode.py @@ -10,7 +10,7 @@ from PLC.Peers import Peers from PLC.Sites import Sites from PLC.Nodes import Node, Nodes from PLC.TagTypes import TagTypes -from PLC.NodeTags import NodeTags +from PLC.NodeTags import NodeTags, NodeTag from PLC.Methods.AddNodeTag import AddNodeTag from PLC.Methods.UpdateNodeTag import UpdateNodeTag @@ -102,10 +102,16 @@ class UpdateNode(Method): raise PLCInvalidArgument,"No such TagType %s"%tagname node_tags=NodeTags(self.api,{'tagname':tagname,'node_id':node['node_id']}) if not node_tags: - AddNodeTag(self.api).__call__(auth,node['node_id'],tagname,value) + node_tag = NodeTag(self.api) + node_tag['node_id'] = node['node_id'] + node_tag['tag_type_id'] = tag_type['tag_type_id'] + node_tag['tagname'] = tagname + node_tag['value'] = value + node_tag.sync() else: - UpdateNodeTag(self.api).__call__(auth,node_tags[0]['node_tag_id'],value) - + node_tag = node_tags[0] + node_tag['value'] = value + node_tag.sync() # Logging variables self.event_objects = {'Node': [node['node_id']]} if 'hostname' in node: