X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FPeers.py;h=c272a2acc15358f8e39419d9f3b89c13ec9f588b;hb=19d4a01ccf66af9e00914351b3eacd5fc880f988;hp=fb47b6e92cead710c8cfc7293b220e124ba75ae8;hpb=00b458601d8f318b617b43d11cb4fdb93e89967c;p=plcapi.git diff --git a/PLC/Peers.py b/PLC/Peers.py index fb47b6e..c272a2a 100644 --- a/PLC/Peers.py +++ b/PLC/Peers.py @@ -1,14 +1,14 @@ -# $Id$ -# $URL$ # # Thierry Parmentelat - INRIA # import re from types import StringTypes +import traceback from urlparse import urlparse import PLC.Auth +from PLC.Logger import logger from PLC.Faults import * from PLC.Namespace import hostname_to_hrn from PLC.Parameter import Parameter, Mixed @@ -165,14 +165,17 @@ class Peer(Row): 'peer_node_id': peer_node_id}, commit = commit) - # attempt to manually update the 'hrn' tag - root_auth = self['hrn_root'] sites = Sites(self.api, node['site_id'], ['login_base']) site = sites[0] login_base = site['login_base'] - hrn = hostname_to_hrn(root_auth, login_base, node['hostname']) - tags = {'hrn': hrn} - Node(self.api, node).update_tags(tags) + 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: + logger.exception("Could not find out hrn on hostname=%s"%node['hostname']) def remove_node(self, node, commit = True): """ @@ -181,7 +184,7 @@ class Peer(Row): remove = Row.remove_object(Node, 'peer_node') remove(self, node, commit) - # attempt to manually update the 'hrn' tag + # attempt to manually update the 'hrn' tag now that the node is local root_auth = self.api.config.PLC_HRN_ROOT sites = Sites(self.api, node['site_id'], ['login_base']) site = sites[0]