cleaned up globals - except in the foreign plugins for eucalyptus and MAX
[sfa.git] / sfa / plc / sfa-import-plc.py
index 084b90c..18727c6 100755 (executable)
@@ -1,8 +1,5 @@
 #!/usr/bin/python
 #
-### $Id$
-### $URL$
-#
 ##
 # Import PLC records into the SFA database. It is indended that this tool be
 # run once to create SFA records that reflect the current state of the
@@ -20,6 +17,7 @@
 import getopt
 import sys
 import tempfile
+import logging
 
 from sfa.util.record import *
 from sfa.util.table import SfaTable
@@ -33,7 +31,6 @@ from sfa.trust.gid import create_uuid
 from sfa.plc.sfaImport import sfaImport
 
 def process_options():
-   global hrn
 
    (options, args) = getopt.getopt(sys.argv[1:], '', [])
    for opt in options:
@@ -67,10 +64,9 @@ def main():
     interface_hrn = config.SFA_INTERFACE_HRN
     keys_filename = config.config_path + os.sep + 'person_keys.py' 
     sfaImporter = sfaImport()
+    if config.SFA_API_DEBUG: sfaImporter.logger.setLevel(logging.DEBUG)
     shell = sfaImporter.shell
     plc_auth = sfaImporter.plc_auth 
-    AuthHierarchy = sfaImporter.AuthHierarchy
-    TrustedRoots = sfaImporter.TrustedRoots
     table = SfaTable()
 
     if not table.exists():
@@ -82,8 +78,8 @@ def main():
         sfaImporter.create_top_level_auth_records(interface_hrn)
 
     sfaImporter.logger.info("Import: adding " + interface_hrn + " to trusted list")
-    authority = AuthHierarchy.get_auth_info(interface_hrn)
-    TrustedRoots.add_gid(authority.get_gid_object())
+    authority = sfaImporter.AuthHierarchy.get_auth_info(interface_hrn)
+    sfaImporter.TrustedRoots.add_gid(authority.get_gid_object())
 
     if ".vini" in interface_hrn and interface_hrn.endswith('vini'):
         # create a fake internet2 site first