Cleaning up end for the slab-import script.
[sfa.git] / sfa / senslab / slab-import.py
index 55bf2f8..57cfd30 100644 (file)
@@ -68,7 +68,7 @@ def import_node(hrn, node):
     node_record['authority'] = get_authority(node_record['hrn'])
     existing_records = table.find({'hrn': hrn, 'type': 'node', 'pointer': node['node_id']})
     if not existing_records:
-        print sys.stderr, " \r\n \t slab-import : node record %s inserted" %(node_record['hrn'])
+        print>>sys.stderr, " \r\n \t slab-import : node record %s inserted" %(node_record['hrn'])
         table.insert(node_record)
     else:
         existing_record = existing_records[0]
@@ -79,7 +79,7 @@ def import_node(hrn, node):
 def import_person(person):       
     existing_records = table.find({'hrn': person['hrn'], 'type': 'user'})
     if not existing_records:
-        print sys.stderr, " \r\n \t slab-import : person record %s inserted" %(person['hrn'])
+        print>>sys.stderr, " \r\n \t slab-import : person record %s inserted" %(person['hrn'])
         table.insert(person)
     else:
         existing_record = existing_records[0]
@@ -92,7 +92,7 @@ def delete_record( hrn, type):
     # delete the record
     record_list = table.find({'type': type, 'hrn': hrn})
     for record in record_list:
-        print sys.stderr, " \r\n \t slab-import : record %s deleted" %(record['hrn'])
+        print>>sys.stderr, " \r\n \t slab-import : record %s deleted" %(record['hrn'])
         table.remove(record)
                 
 def hostname_to_hrn(root_auth,hostname):
@@ -171,7 +171,6 @@ def main():
         hrn =  hostname_to_hrn( root_auth, node['hostname'])
         if hrn not in existing_hrns or \
         (hrn, 'node') not in existing_records:
-            print "\t\t NODE HRN NOT in existing record, importing it" ,hrn
             import_node(hrn, node)
 
    # import persons
@@ -225,7 +224,6 @@ def main():
         elif type == 'node':
             login_base = get_leaf(get_authority(record_hrn))
             nodename = Xrn.unescape(get_leaf(record_hrn))
-            print "type: node :  nodename %s" %(nodename)
             for node in nodes_dict:
                 if node['hostname'] == nodename :
                     found = True