fix error message when keyconvert is not found. Add special case for hrn names in...
authorTony Mack <tmack@cs.princeton.edu>
Wed, 20 May 2009 20:06:09 +0000 (20:06 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Wed, 20 May 2009 20:06:09 +0000 (20:06 +0000)
geni/gimport.py

index 78e9642..588c755 100755 (executable)
@@ -67,7 +67,7 @@ for path in files:
         break
 
 if not loaded:
-    raise Exception, "Could not find config in " + ", ".join(files)        
+    raise Exception, "Could not find keyconvert in " + ", ".join(files)        
 
 def un_unicode(str):
    if isinstance(str, unicode):
@@ -290,9 +290,19 @@ def import_site(parent_hrn, site):
     AuthHierarchy = Hierarchy()
     sitename = site['login_base']
     sitename = cleanup_string(sitename)
-
+    
     hrn = parent_hrn + "." + sitename
 
+    # Hardcode 'internet2' into the hrn for sites hosting 
+    # internet2 nodes. This is a special operation for some vini
+    # sites
+    if parent_hrn.find(".vini.") != -1 and 'abbreviated_name' in site:
+        abv_name = site['abbreviated_name']
+        if abv_name.find("I2") != -1 or abv_name.find("NLR") != -1:
+            if sitename.startswith("ii"): sitename.replace("ii", "")
+            if sitename.startswith("nlr"): sitename.replace("nlr", "")
+            hrn = ".".join([parent_hrn, "internet2", sitename]) 
     report.trace("Import_Site: importing site " + hrn)
 
     # create the authority