remove dependency of Config module from TrustedRoots class
authorScott Baker <bakers@cs.arizona.edu>
Wed, 30 Sep 2009 23:20:21 +0000 (23:20 +0000)
committerScott Baker <bakers@cs.arizona.edu>
Wed, 30 Sep 2009 23:20:21 +0000 (23:20 +0000)
sfa/plc/sfaImport.py
sfa/server/sfa-server.py
sfa/trust/trustedroot.py
sfa/util/config.py

index 02208a1..3323080 100644 (file)
@@ -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()
index 968324e..5e1db72 100755 (executable)
@@ -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):
index ea4a694..90dfe46 100644 (file)
@@ -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
index d58243e..b6c62c0 100644 (file)
@@ -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')):