From a3bf61fdc8315c475c07d733aac3b49981c42825 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 30 Sep 2009 23:20:21 +0000 Subject: [PATCH] remove dependency of Config module from TrustedRoots class --- sfa/plc/sfaImport.py | 2 +- sfa/server/sfa-server.py | 4 +++- sfa/trust/trustedroot.py | 6 +----- sfa/util/config.py | 3 +++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sfa/plc/sfaImport.py b/sfa/plc/sfaImport.py index 02208a15..3323080d 100644 --- a/sfa/plc/sfaImport.py +++ b/sfa/plc/sfaImport.py @@ -52,7 +52,7 @@ class sfaImport: def __init__(self): self.AuthHierarchy = Hierarchy() - self.TrustedRoots = TrustedRootList() + self.TrustedRoots = TrustedRootList(Config.get_trustedroots_dir()) self.config = Config() self.plc_auth = self.config.get_plc_auth() diff --git a/sfa/server/sfa-server.py b/sfa/server/sfa-server.py index 968324e4..5e1db725 100755 --- a/sfa/server/sfa-server.py +++ b/sfa/server/sfa-server.py @@ -46,6 +46,8 @@ from sfa.server.slicemgr import SliceMgr from sfa.trust.hierarchy import Hierarchy +from sfa.util.config import Config + # after http://www.erlenstar.demon.co.uk/unix/faq_2.html def daemon(): """Daemonize the current process.""" @@ -110,7 +112,7 @@ def main(): AuthHierarchy = Hierarchy() - TrustedRoots = TrustedRootList() + TrustedRoots = TrustedRootList(Config().get_trustedroots_dir()) # start registry server if (options.registry): diff --git a/sfa/trust/trustedroot.py b/sfa/trust/trustedroot.py index ea4a6946..90dfe462 100644 --- a/sfa/trust/trustedroot.py +++ b/sfa/trust/trustedroot.py @@ -4,13 +4,9 @@ import os from sfa.trust.gid import * -from sfa.util.config import Config class TrustedRootList: - def __init__(self, dir=None): - if not dir: - # keep trusted roots in /etc/sfa - dir = Config().config_path + os.sep + 'trusted_roots' + def __init__(self, dir): self.basedir = dir # create the directory to hold the files diff --git a/sfa/util/config.py b/sfa/util/config.py index d58243e0..b6c62c0b 100644 --- a/sfa/util/config.py +++ b/sfa/util/config.py @@ -41,6 +41,9 @@ class Config: except IOError, e: raise IOError, "Could not find the configuration file: %s" % config_file + def get_trustedroots_dir(self): + return self.config_path + os.sep + 'trusted_roots' + def get_openflow_aggrMgr_info(self): aggr_mgr_ip = 'localhost' if (hasattr(self,'OPENFLOW_AGGREGATE_MANAGER_IP')): -- 2.43.0