From eaadba7c5b21d19b4e2240900ba3f1a65deb4077 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 18 Jan 2011 18:04:13 -0500 Subject: [PATCH] support differnt authority types --- sfa/plc/sfaImport.py | 2 +- sfa/util/xrn.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sfa/plc/sfaImport.py b/sfa/plc/sfaImport.py index 3f197412..117a2206 100644 --- a/sfa/plc/sfaImport.py +++ b/sfa/plc/sfaImport.py @@ -104,7 +104,7 @@ class sfaImport: # just create certs for all sfa interfaces even if they # arent enabled interface_hrn = self.config.SFA_INTERFACE_HRN - interfaces = ['sa', 'am', 'sm'] + interfaces = ['authority+sa', 'authority+am', 'authority+sm'] table = SfaTable() auth_info = self.AuthHierarchy.get_auth_info(interface_hrn) pkey = auth_info.get_pkey_object() diff --git a/sfa/util/xrn.py b/sfa/util/xrn.py index 0d5e6bf5..8ee83315 100644 --- a/sfa/util/xrn.py +++ b/sfa/util/xrn.py @@ -113,7 +113,12 @@ class Xrn: parts = Xrn.urn_split(self.urn) type=parts.pop(2) # Remove the authority name (e.g. '.sa') - if type == 'authority': parts.pop() + if type == 'authority': + name = parts.pop() + # Drop the sa. This is a bad hack, but its either this + # or completely change how record types are generated/stored + if name != 'sa': + type = type + "+" + name # convert parts (list) into hrn (str) by doing the following # 1. remove blank parts @@ -134,9 +139,13 @@ class Xrn: if self.hrn.startswith(Xrn.URN_PREFIX): raise SfaAPIError, "Xrn.hrn_to_urn, hrn=%s"%self.hrn - if self.type == 'authority': + if self.type.startswith('authority'): self.authority = Xrn.hrn_split(self.hrn) - name = 'sa' + type_parts = self.type.split("+") + self.type = type_parts[0] + name = 'sa' + if len(type_parts) > 1: + name = type_parts[1] else: self.authority = Xrn.hrn_auth_list(self.hrn) name = Xrn.hrn_leaf(self.hrn) -- 2.45.2