From: Tony Mack Date: Mon, 24 Jan 2011 21:34:51 +0000 (-0500) Subject: preserve nodes full hostname in hrn/urn X-Git-Tag: sfa-1.0-12~4 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=971a1919c7621d9443efbae4c532dca895dd06ee;p=sfa.git preserve nodes full hostname in hrn/urn --- diff --git a/sfa/plc/sfa-import-plc.py b/sfa/plc/sfa-import-plc.py index 7077eb6e..7b96c359 100755 --- a/sfa/plc/sfa-import-plc.py +++ b/sfa/plc/sfa-import-plc.py @@ -26,6 +26,7 @@ from sfa.util.config import Config from sfa.trust.certificate import convert_public_key, Keypair from sfa.trust.trustedroot import * from sfa.trust.hierarchy import * +from sfa.util.xrn import Xrn from sfa.plc.api import * from sfa.trust.gid import create_uuid from sfa.plc.sfaImport import sfaImport @@ -161,7 +162,7 @@ def main(): hrn = hostname_to_hrn(interface_hrn, site['login_base'], node['hostname']) if hrn not in existing_hrns or \ (hrn, 'node') not in existing_records: - sfaImporter.import_node(site_hrn, node) + sfaImporter.import_node(hrn, node) # import slices for slice_id in site['slice_ids']: @@ -241,11 +242,11 @@ def main(): elif type == 'node': login_base = get_leaf(get_authority(record_hrn)) - nodename = get_leaf(record_hrn) + nodename = Xrn.unescape(get_leaf(record_hrn)) if login_base in sites_dict: site = sites_dict[login_base] for node in nodes: - tmp_nodename = node['hostname'].split(".")[0] + tmp_nodename = node['hostname'] if tmp_nodename == nodename and \ node['site_id'] == site['site_id'] and \ node['node_id'] == record['pointer']: diff --git a/sfa/plc/sfaImport.py b/sfa/plc/sfaImport.py index 117a2206..238b5e1b 100644 --- a/sfa/plc/sfaImport.py +++ b/sfa/plc/sfaImport.py @@ -187,15 +187,7 @@ class sfaImport: slice_record['record_id'] = existing_record['record_id'] table.update(slice_record) - def import_node(self, parent_hrn, node): - nodename = node['hostname'].split(".")[0] - nodename = _cleanup_string(nodename) - - if not nodename: - self.logger.error("Import: failed to parse node %s" %node['hostname']) - return - - hrn = parent_hrn + "." + nodename + def import_node(self, hrn, node): self.logger.info("Import: node %s" % hrn) # ASN.1 will have problems with hrn's longer than 64 characters if len(hrn) > 64: