cleanup for config - again
[sfa.git] / sfa / trust / hierarchy.py
index 7953df3..c73d858 100644 (file)
@@ -20,17 +20,17 @@ import os
 from sfa.util.report import *
 from sfa.trust.certificate import Keypair
 from sfa.trust.credential import *
-from sfa.trust.gid import *
+from sfa.trust.gid import GID, create_uuid
 
 from sfa.util.misc import *
-from sfa.util.config import *
-from sfa.util.geniticket import *
+from sfa.util.config import Config
+from sfa.util.sfaticket import SfaTicket
 
 ##
 # The AuthInfo class contains the information for an authority. This information
 # includes the GID, private key, and database connection information.
 
-class AuthInfo():
+class AuthInfo:
     hrn = None
     gid_object = None
     gid_filename = None
@@ -102,7 +102,7 @@ class AuthInfo():
 # contains the GID, pkey, and dbinfo files for that authority (as well as
 # subdirectories for each sub-authority)
 
-class Hierarchy():
+class Hierarchy:
     ##
     # Create the hierarchy object.
     #
@@ -111,7 +111,7 @@ class Hierarchy():
     def __init__(self, basedir = None):
         if not basedir:
             config = Config()
-            basedir = config.config_path + os.sep + "authorities"
+            basedir = os.path.join(config.SFA_BASE_DIR, "authorities")
         self.basedir = basedir
     ##
     # Given a hrn, return the filenames of the GID, private key, and dbinfo
@@ -152,7 +152,7 @@ class Hierarchy():
     # @param create_parents if true, also create the parents if they do not exist
 
     def create_auth(self, hrn, create_parents=False):
-        report.trace("Hierarchy: creating authority: " + hrn)
+        trace("Hierarchy: creating authority: " + hrn)
 
         # create the parent authority if necessary
         parent_hrn = get_authority(hrn)
@@ -182,7 +182,7 @@ class Hierarchy():
 
         # XXX TODO: think up a better way for the dbinfo to work
 
-        dbinfo = get_default_dbinfo()
+        dbinfo = Config().get_plc_dbinfo()
         dbinfo_file = file(dbinfo_filename, "w")
         dbinfo_file.write(str(dbinfo))
         dbinfo_file.close()
@@ -195,7 +195,7 @@ class Hierarchy():
     # @param hrn the human readable name of the authority to create.
 
     def get_auth_info(self, hrn):
-        #report.trace("Hierarchy: getting authority: " + hrn)
+        #trace("Hierarchy: getting authority: " + hrn)
    
         if not self.auth_exists(hrn):
             raise MissingAuthority(hrn)
@@ -318,7 +318,7 @@ class Hierarchy():
         auth_info = self.get_auth_info(hrn)
         gid = auth_info.get_gid_object()
 
-        ticket = Ticket(subject=hrn)
+        ticket = SfaTicket(subject=hrn)
         ticket.set_gid_caller(gid)
         ticket.set_gid_object(gid)
         ticket.set_delegate(True)