added sfa upcalls
authorTony Mack <tmack@cs.princeton.edu>
Tue, 4 Aug 2009 02:26:52 +0000 (02:26 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Tue, 4 Aug 2009 02:26:52 +0000 (02:26 +0000)
PLC/Methods/AddPersonKey.py
PLC/Methods/AddSite.py
PLC/Methods/AddSlice.py
PLC/Methods/DeletePerson.py
PLC/Methods/DeleteSite.py
PLC/Methods/DeleteSlice.py

index cdf0235..3a06a34 100644 (file)
@@ -6,6 +6,7 @@ from PLC.Parameter import Parameter, Mixed
 from PLC.Keys import Key, Keys
 from PLC.Persons import Person, Persons
 from PLC.Auth import Auth
+from PLC.SFA import SFA
 
 can_update = lambda (field, value): field in ['key_type','key']
 
@@ -53,9 +54,13 @@ class AddPersonKey(Method):
         person.add_key(key, commit = True)
 
         # Logging variables
-       self.event_objects = {'Person': [person['person_id']],
-                             'Key': [key['key_id']]}
-       self.message = 'Key %d added to person %d' % \
-               (key['key_id'], person['person_id'])
+        self.event_objects = {'Person': [person['person_id']],
+                              'Key': [key['key_id']]}
+        self.message = 'Key %d added to person %d' % \
+                        (key['key_id'], person['person_id'])
 
+        # sync with the geni db
+        sfa = SFA()
+        sfa.update_record(person, 'person') 
+        
         return key['key_id']
index b506faa..bda21ce 100644 (file)
@@ -5,6 +5,7 @@ from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Sites import Site, Sites
 from PLC.Auth import Auth
+from PLC.SFA import SFA
 
 can_update = lambda (field, value): field in \
              ['name', 'abbreviated_name', 'login_base',
@@ -36,8 +37,11 @@ class AddSite(Method):
         site = Site(self.api, site_fields)
         site.sync()
        
-       # Logging variables 
-       self.event_objects = {'Site': [site['site_id']]}
+        # Logging variables 
+        self.event_objects = {'Site': [site['site_id']]}
         self.message = 'Site %d created' % site['site_id']
        
-       return site['site_id']
+        sfa = SFA()
+        sfa.update_record(site, 'site', site['login_base'])
+
+        return site['site_id']
index 8dceb6f..78016b3 100644 (file)
@@ -14,6 +14,7 @@ from PLC.TagTypes import TagTypes
 from PLC.SliceTags import SliceTags
 from PLC.Methods.AddSliceTag import AddSliceTag
 from PLC.Methods.UpdateSliceTag import UpdateSliceTag
+from PLC.SFA import SFA
 
 can_update = ['name', 'instantiation', 'url', 'description', 'max_nodes']
 
@@ -102,7 +103,9 @@ class AddSlice(Method):
             else:
                 UpdateSliceTag(self.api).__call__(auth,slice_tags[0]['slice_tag_id'],value)
 
-       self.event_objects = {'Slice': [slice['slice_id']]}
+        self.event_objects = {'Slice': [slice['slice_id']]}
         self.message = "Slice %d created" % slice['slice_id']
-
+    
+        sfa = SFA()
+        sfa.update_record(slice, 'slice', site['login_base']) 
         return slice['slice_id']
index 893b16e..738850c 100644 (file)
@@ -5,6 +5,7 @@ from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Persons import Person, Persons
 from PLC.Auth import Auth
+from PLC.SFA import SFA
 
 class DeletePerson(Method):
     """
@@ -46,8 +47,11 @@ class DeletePerson(Method):
 
         person.delete()
        
-       # Logging variables
-       self.event_objects = {'Person': [person['person_id']]}
-       self.message = 'Person %d deleted' % person['person_id']
+        # Logging variables
+        self.event_objects = {'Person': [person['person_id']]}
+        self.message = 'Person %d deleted' % person['person_id']
+
+        sfa = SFA()
+        sfa.delete_record(person, 'person')
 
         return 1
index 9f3cdf5..1eee12c 100644 (file)
@@ -8,6 +8,7 @@ from PLC.Persons import Person, Persons
 from PLC.Nodes import Node, Nodes
 from PLC.PCUs import PCU, PCUs
 from PLC.Auth import Auth
+from PLC.SFA import SFA
 
 class DeleteSite(Method):
     """
@@ -41,8 +42,11 @@ class DeleteSite(Method):
 
         site.delete()
        
-       # Logging variables
-       self.event_objects = {'Site': [site['site_id']]}
-       self.message = 'Site %d deleted' % site['site_id']      
+        # Logging variables
+        self.event_objects = {'Site': [site['site_id']]}
+        self.message = 'Site %d deleted' % site['site_id']     
 
+        sfa = SFA()
+        sfa.delete_record(site, 'site')
+        
         return 1
index d3bc8f4..29840ee 100644 (file)
@@ -5,6 +5,7 @@ from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Slices import Slice, Slices
 from PLC.Auth import Auth
+from PLC.SFA import SFA
 
 class DeleteSlice(Method):
     """
@@ -47,4 +48,7 @@ class DeleteSlice(Method):
         slice.delete()
         self.event_objects = {'Slice': [slice['slice_id']]}
 
+        sfa = SFA()
+        sfa.delete_record(slice, 'slice')
+
         return 1