updated the geniwrapper up calls to use PLC.Geni.GeniSync
authorTony Mack <tmack@cs.princeton.edu>
Wed, 15 Apr 2009 03:08:44 +0000 (03:08 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Wed, 15 Apr 2009 03:08:44 +0000 (03:08 +0000)
PLC/Methods/AddPersonKey.py

index aa4ed00..3c70e59 100644 (file)
@@ -4,6 +4,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.Geni import GeniSync
 
 can_update = lambda (field, value): field in ['key_type','key']
 
@@ -41,7 +42,7 @@ class AddPersonKey(Method):
         if person['peer_id'] is not None:
             raise PLCInvalidArgument, "Not a local account"
 
-       # If we are not admin, make sure caller is adding a key to their account
+    # If we are not admin, make sure caller is adding a key to their account
         if 'admin' not in self.caller['roles']:
             if person['person_id'] != self.caller['person_id']:
                 raise PLCPermissionDenied, "You may only modify your own keys"
@@ -51,9 +52,12 @@ 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'])
+
+        geni = GeniSync()
+        geni.do_update(person, 'person')
 
         return key['key_id']