- now using event_objects to log affected objects
authorTony Mack <tmack@cs.princeton.edu>
Tue, 27 Feb 2007 19:31:56 +0000 (19:31 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Tue, 27 Feb 2007 19:31:56 +0000 (19:31 +0000)
16 files changed:
PLC/Methods/UpdateAddress.py
PLC/Methods/UpdateAddressType.py
PLC/Methods/UpdateConfFile.py
PLC/Methods/UpdateKey.py
PLC/Methods/UpdateMessage.py
PLC/Methods/UpdateNode.py
PLC/Methods/UpdateNodeGroup.py
PLC/Methods/UpdateNodeNetwork.py
PLC/Methods/UpdatePCU.py
PLC/Methods/UpdatePeer.py
PLC/Methods/UpdatePerson.py
PLC/Methods/UpdateSite.py
PLC/Methods/UpdateSlice.py
PLC/Methods/UpdateSliceAttribute.py
PLC/Methods/UpdateSliceAttributeType.py
PLC/Methods/VerifyPerson.py

index 3573573..ed2fd43 100644 (file)
@@ -47,7 +47,7 @@ class UpdateAddress(Method):
         address.sync()
        
        # Logging variables
-       self.object_ids = [address['address_id']]
+       self.event_objects = {'Address': [address['address_id']]}
        self.message = 'Address %d updated: %s' % \
                (address['address_id'], ", ".join(address_fields.keys()))
         
index 8dd9159..922c940 100644 (file)
@@ -37,6 +37,6 @@ class UpdateAddressType(Method):
 
         address_type.update(address_type_fields)
         address_type.sync()
-       self.object_ids = [address_type['address_type_id']]
+       self.event_objects = {'AddressType': [address_type['address_type_id']]}
 
         return 1
index 4e94208..6fd0e2a 100644 (file)
@@ -37,6 +37,6 @@ class UpdateConfFile(Method):
         conf_file = conf_files[0]
         conf_file.update(conf_file_fields)
         conf_file.sync()
-       self.object_ids = [conf_file['conf_file_id']]   
+       self.event_objects = {'ConfFile': [conf_file['conf_file_id']]}  
 
         return 1
index a1754ff..0fb560b 100644 (file)
@@ -49,7 +49,7 @@ class UpdateKey(Method):
         key.sync()
        
        # Logging variables
-       self.object_ids = [key['key_id']]
+       self.event_objects = {'Key': [key['key_id']]}
        self.message = 'key %d updated: %s' % \
                (key['key_id'], ", ".join(key_fields.keys()))
         return 1
index 61ac458..e44dca4 100644 (file)
@@ -38,6 +38,6 @@ class UpdateMessage(Method):
 
         message.update(message_fields)
         message.sync()
-       self.object_ids = [message['message_id']]
+       self.event_objects = {'Message': [message['message_id']]}
 
         return 1
index 28a0413..b20d3c5 100644 (file)
@@ -32,8 +32,6 @@ class UpdateNode(Method):
 
     returns = Parameter(int, '1 if successful')
 
-    object_type = 'Node'
-
     def call(self, auth, node_id_or_hostname, node_fields):
         node_fields = dict(filter(can_update, node_fields.items()))
 
@@ -65,7 +63,7 @@ class UpdateNode(Method):
         node.sync()
        
        # Logging variables
-       self.object_ids = [node['node_id']]
+       self.event_objects = {'Node': [node['node_id']]}
        self.message = 'Node %d updated: %s.' % \
                (node['node_id'], ", ".join(node_fields.keys()))
        if 'boot_state' in node_fields.keys():
index 5d31026..78042be 100644 (file)
@@ -40,7 +40,7 @@ class UpdateNodeGroup(Method):
         nodegroup.sync()
        
        # Logging variables
-       self.object_ids = [nodegroup['nodegroup_id']]
+       self.event_objects = {'NodeGroup': [nodegroup['nodegroup_id']]}
        self.message = 'Node group %d updated: %s' % \
                (nodegroup['nodegroup_id'], ", ".join(nodegroup_fields.keys()))  
         return 1
index 3936e3d..dc1e65a 100644 (file)
@@ -62,7 +62,7 @@ class UpdateNodeNetwork(Method):
        nodenetwork.update(nodenetwork_fields)
         nodenetwork.sync()
        
-       self.object_ids = [nodenetwork['nodenetwork_id']]
+       self.event_objects = {'NodeNetwork': [nodenetwork['nodenetwork_id']]}
        self.message = "Node network %d updated: %s " % \
            (nodenetwork['nodenetwork_id'], ", ".join(nodenetwork_fields.keys()))
 
index 1c915ac..8916684 100644 (file)
@@ -46,7 +46,7 @@ class UpdatePCU(Method):
         pcu.sync()
        
        # Logging variables
-       self.object_ids = [pcu['pcu_id']]
+       self.event_objects = {'PCU': [pcu['pcu_id']]}
        self.message = 'PCU %d updated: %s' % \
                (pcu['pcu_id'], ", ".join(pcu_fields.keys()))
         return 1
index dd5f2c8..8586a48 100644 (file)
@@ -45,6 +45,6 @@ class UpdatePeer(Method):
         peer.sync()
 
         # Log affected objects
-       self.object_ids = [peer['peer_id']]
+       self.event_objects = {'Peer': [peer['peer_id']]}
 
        return 1
index 594f1ff..816f98e 100644 (file)
@@ -33,8 +33,6 @@ class UpdatePerson(Method):
 
     returns = Parameter(int, '1 if successful')
 
-    object_type = 'Person'
-
     def call(self, auth, person_id_or_email, person_fields):
         person_fields = dict(filter(can_update, person_fields.items()))
 
@@ -58,7 +56,7 @@ class UpdatePerson(Method):
         person.sync()
        
        # Logging variables
-       self.object_ids = [person['person_id']]
+       self.event_objects = {'Person': [person['person_id']]}
 
         # Redact password
         if 'password' in person_fields:
index e46582a..2e4d95d 100644 (file)
@@ -33,8 +33,6 @@ class UpdateSite(Method):
 
     returns = Parameter(int, '1 if successful')
 
-    object_type = 'Site'
-
     def call(self, auth, site_id_or_login_base, site_fields):
         site_fields = dict(filter(can_update, site_fields.items()))
 
@@ -65,7 +63,7 @@ class UpdateSite(Method):
        site.sync()
        
        # Logging variables
-       self.object_ids = [site['site_id']]
+       self.event_objects = {'Site': [site['site_id']]}
        self.message = 'Site %d updated: %s' % \
                (site['site_id'], ", ".join(site_fields.keys()))        
        
index 357a10f..2596c74 100644 (file)
@@ -39,8 +39,6 @@ class UpdateSlice(Method):
 
     returns = Parameter(int, '1 if successful')
 
-    object_type = 'Slice'
-
     def call(self, auth, slice_id_or_name, slice_fields):
         slice_fields = dict(filter(can_update, slice_fields.items()))
 
@@ -89,6 +87,6 @@ class UpdateSlice(Method):
             raise PLCInvalidArgument, "Cannot renew a slice with an empty description or URL"
 
         slice.sync()
-       self.object_ids = [slice['slice_id']]
+       self.event_objects = {'Slice': [slice['slice_id']]}
 
         return 1
index 5b7d48f..80122ac 100644 (file)
@@ -27,8 +27,6 @@ class UpdateSliceAttribute(Method):
 
     returns = Parameter(int, '1 if successful')
 
-    object_type = 'Slice'
-
     def call(self, auth, slice_attribute_id, value):
         slice_attributes = SliceAttributes(self.api, [slice_attribute_id])
         if not slice_attributes:
@@ -59,5 +57,5 @@ class UpdateSliceAttribute(Method):
 
         slice_attribute['value'] = value
         slice_attribute.sync()
-       self.object_ids = [slice_attribute['slice_attribute_id']]
+       self.event_objects = {'SliceAttribute': [slice_attribute['slice_attribute_id']]}
         return 1
index a6c7701..145a51d 100644 (file)
@@ -38,6 +38,6 @@ class UpdateSliceAttributeType(Method):
 
         attribute_type.update(attribute_type_fields)
         attribute_type.sync()
-       self.object_ids = [attribute_type['attribute_type_id']]
+       self.event_objects = {'AttributeType': [attribute_type['attribute_type_id']]}
 
         return 1
index 3f1591a..fd4adb7 100644 (file)
@@ -146,7 +146,7 @@ class VerifyPerson(Method):
             print >> log, "Warning: No message template '%s'" % message_id
 
        # Logging variables
-        self.object_ids = [person['person_id']]
+        self.event_objects = {'Person': [person['person_id']]}
         self.message = message_id
        
        if verification_key is not None and person['verification_expires'] and \