X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FUpdateNode.py;h=973dbb92aa9b77c250792770db51a03360b8ce6e;hb=19d4a01ccf66af9e00914351b3eacd5fc880f988;hp=2927f73aa9a1834358cc599b92a3d3258b92cb54;hpb=053fd6410f733aef90482cda571059ed116d40e1;p=plcapi.git diff --git a/PLC/Methods/UpdateNode.py b/PLC/Methods/UpdateNode.py index 2927f73..973dbb9 100644 --- a/PLC/Methods/UpdateNode.py +++ b/PLC/Methods/UpdateNode.py @@ -1,5 +1,3 @@ -# $Id$ -# $URL$ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed @@ -11,8 +9,6 @@ from PLC.Sites import Sites from PLC.Nodes import Node, Nodes from PLC.TagTypes import TagTypes from PLC.NodeTags import NodeTags, NodeTag -from PLC.Methods.AddNodeTag import AddNodeTag -from PLC.Methods.UpdateNodeTag import UpdateNodeTag admin_only = [ 'key', 'session', 'boot_nonce', 'site_id'] can_update = ['hostname', 'node_type', 'boot_state', 'model', 'version'] + admin_only @@ -98,8 +94,10 @@ class UpdateNode(Method): for (tagname,value) in tags.iteritems(): # the tagtype instance is assumed to exist, just check that - if not TagTypes(self.api,{'tagname':tagname}): + tag_types = TagTypes(self.api,{'tagname':tagname}) + if not tag_types: raise PLCInvalidArgument,"No such TagType %s"%tagname + tag_type = tag_types[0] node_tags=NodeTags(self.api,{'tagname':tagname,'node_id':node['node_id']}) if not node_tags: node_tag = NodeTag(self.api) @@ -112,6 +110,7 @@ class UpdateNode(Method): 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: