- # calling UpdateNode with the node's hostname
- # will force the 'hrn' tag to be updated with the
- # correct root auth
- from PLC.Methods.UpdateNode import UpdateNode
- UpdateNode.__call__(UpdateNode(self.api), auth, node['node_id'], {'hostname': node['hostname']})
+ sites = Sites(self.api, node['site_id'], ['login_base'])
+ site = sites[0]
+ login_base = site['login_base']
+ try:
+ # attempt to manually update the 'hrn' tag with the remote prefix
+ hrn_root = self['hrn_root']
+ hrn = hostname_to_hrn(hrn_root, login_base, node['hostname'])
+ tags = {'hrn': hrn}
+ Node(self.api, node).update_tags(tags)
+ except:
+ print >>log, "WARNING: (beg) could not find out hrn on hostname=%s"%node['hostname']
+ traceback.print_exc(5,log)
+ print >>log, "WARNING: (end) could not find out hrn on hostname=%s"%node['hostname']