X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAddNode.py;h=90cf14f1ccdd6c499889377ccf43bd9e1ea97244;hb=b4b902d85a7966403dc09cc1c3f0da8a07b7a1e9;hp=84031627b1ceb2c7db4d7defb3552b2fd085786c;hpb=2e1a54e6ba7ec6db22ad98342acaa943ca83c13e;p=plcapi.git diff --git a/PLC/Methods/AddNode.py b/PLC/Methods/AddNode.py index 8403162..90cf14f 100644 --- a/PLC/Methods/AddNode.py +++ b/PLC/Methods/AddNode.py @@ -5,7 +5,8 @@ from PLC.Auth import Auth from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Table import Row - +from PLC.Namespace import hostname_to_hrn +from PLC.Peers import Peers from PLC.Sites import Site, Sites from PLC.Nodes import Node, Nodes from PLC.TagTypes import TagTypes @@ -72,6 +73,14 @@ class AddNode(Method): node['site_id'] = site['site_id'] node.sync() + # since hostname was specified lets add the 'hrn' node tag + root_auth = self.api.config.PLC_HRN_ROOT + # sub auth is the login base of this node's site + sites = Sites(self.api, node['site_id'], ['login_base']) + site = sites[0] + login_base = site['login_base'] + tags['hrn'] = hostname_to_hrn(root_auth, login_base, node['hostname']) + for (tagname,value) in tags.iteritems(): # the tagtype instance is assumed to exist, just check that if not TagTypes(self.api,{'tagname':tagname}):