remove creategid from sfi; store gid creating info in record and silently create...
[sfa.git] / geni / util / record.py
index 086723d..6552961 100644 (file)
@@ -28,7 +28,7 @@ from gid import *
 # of different types. For example, planetlab.us.arizona may have both an SA
 # and a MA record, but cannot have two SA records.
 
-class GeniRecord():
+class GeniRecord:
 
     ##
     # Create a Geni Record
@@ -229,7 +229,11 @@ class GeniRecord():
 
     def load_from_dict(self, dict):
         self.set_name(dict['name'])
-        self.set_gid(dict['gid'])
+
+        gidstr = dict.get("gid", None)
+        if gidstr:
+            self.set_gid(dict['gid'])
+
         self.set_type(dict['type'])
         self.set_pointer(dict['pointer'])
         if "pl_info" in dict:
@@ -279,7 +283,13 @@ class GeniRecord():
         print "    pl_info:"
         pl_info = getattr(self, "pl_info", {})
         if pl_info:
+
             for key in pl_info.keys():
                 print "       ", key, ":", pl_info[key]
 
 
+    def getdict(self):
+        info = {'hrn': self.name, 'type': self.type, 'gid': self.gid}
+        info.update(getattr(self, "geni_info", {}))
+        info.update(getattr(self, "pl_info", {}))
+        return info