Removed hard coded login in GET requests (OARrestapi).
[sfa.git] / sfa / importer / sfaImport.py
index 68cd195..ca0bff2 100644 (file)
@@ -18,7 +18,6 @@ from sfa.trust.hierarchy import Hierarchy
 from sfa.trust.gid import create_uuid
 from sfa.storage.table import SfaTable
 from sfa.storage.record import SfaRecord
-from sfa.storage.table import SfaTable
 
 
 def _un_unicode(str):
@@ -50,14 +49,10 @@ class sfaImport:
     def __init__(self):
        self.logger = _SfaLogger(logfile='/var/log/sfa_import.log', loggername='importlog')
        self.AuthHierarchy = Hierarchy()
-       self.table = SfaTable()     
+#       self.table = SfaTable()     
        self.config = Config()
        self.TrustedRoots = TrustedRoots(Config.get_trustedroots_dir(self.config))
        self.root_auth = self.config.SFA_REGISTRY_ROOT_AUTH
-       # should use a driver instead...
-       from sfa.plc.plshell import PlShell
-       # how to connect to planetlab 
-       self.shell = PlShell (self.config)
 
     def create_top_level_records(self):
         """
@@ -95,7 +90,8 @@ class sfaImport:
         # create the db record if it doesnt already exist    
         auth_info = self.AuthHierarchy.get_auth_info(hrn)
         auth_record = SfaRecord(hrn=hrn, gid=auth_info.get_gid_object(), type="authority", pointer=-1, authority=get_authority(hrn))
-        auth_record.sync(verbose=True)
+        self.logger.info("Import: importing %s " % auth_record.summary_string())
+        auth_record.sync()
 
     def create_sm_client_record(self):
         """
@@ -110,7 +106,8 @@ class sfaImport:
         auth_info = self.AuthHierarchy.get_auth_info(hrn)
         record = SfaRecord(hrn=hrn, gid=auth_info.get_gid_object(), \
                            type="user", pointer=-1, authority=get_authority(hrn))
-        record.sync(verbose=True)
+        self.logger.info("Import: importing %s " % record.summary_string())
+        record.sync()
 
     def create_interface_records(self):
         """
@@ -128,7 +125,8 @@ class sfaImport:
             gid = self.AuthHierarchy.create_gid(urn, create_uuid(), pkey)
             interface_record = SfaRecord(hrn=hrn, type=interface, pointer=-1,
                                          gid = gid, authority=get_authority(hrn))
-            interface_record.sync(verbose=True)
+            self.logger.info("Import: importing %s " % interface_record.summary_string())
+            interface_record.sync()
              
     def delete_record(self, hrn, type):
         # delete the record