From 913c9f6d84886446500a06bce26411a4cc47ebb7 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 27 Feb 2007 19:31:56 +0000 Subject: [PATCH] - now using event_objects to log affected objects --- PLC/Methods/UpdateAddress.py | 2 +- PLC/Methods/UpdateAddressType.py | 2 +- PLC/Methods/UpdateConfFile.py | 2 +- PLC/Methods/UpdateKey.py | 2 +- PLC/Methods/UpdateMessage.py | 2 +- PLC/Methods/UpdateNode.py | 4 +--- PLC/Methods/UpdateNodeGroup.py | 2 +- PLC/Methods/UpdateNodeNetwork.py | 2 +- PLC/Methods/UpdatePCU.py | 2 +- PLC/Methods/UpdatePeer.py | 2 +- PLC/Methods/UpdatePerson.py | 4 +--- PLC/Methods/UpdateSite.py | 4 +--- PLC/Methods/UpdateSlice.py | 4 +--- PLC/Methods/UpdateSliceAttribute.py | 4 +--- PLC/Methods/UpdateSliceAttributeType.py | 2 +- PLC/Methods/VerifyPerson.py | 2 +- 16 files changed, 16 insertions(+), 26 deletions(-) diff --git a/PLC/Methods/UpdateAddress.py b/PLC/Methods/UpdateAddress.py index 3573573f..ed2fd435 100644 --- a/PLC/Methods/UpdateAddress.py +++ b/PLC/Methods/UpdateAddress.py @@ -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())) diff --git a/PLC/Methods/UpdateAddressType.py b/PLC/Methods/UpdateAddressType.py index 8dd91597..922c9409 100644 --- a/PLC/Methods/UpdateAddressType.py +++ b/PLC/Methods/UpdateAddressType.py @@ -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 diff --git a/PLC/Methods/UpdateConfFile.py b/PLC/Methods/UpdateConfFile.py index 4e94208c..6fd0e2a9 100644 --- a/PLC/Methods/UpdateConfFile.py +++ b/PLC/Methods/UpdateConfFile.py @@ -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 diff --git a/PLC/Methods/UpdateKey.py b/PLC/Methods/UpdateKey.py index a1754ff7..0fb560bd 100644 --- a/PLC/Methods/UpdateKey.py +++ b/PLC/Methods/UpdateKey.py @@ -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 diff --git a/PLC/Methods/UpdateMessage.py b/PLC/Methods/UpdateMessage.py index 61ac458c..e44dca47 100644 --- a/PLC/Methods/UpdateMessage.py +++ b/PLC/Methods/UpdateMessage.py @@ -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 diff --git a/PLC/Methods/UpdateNode.py b/PLC/Methods/UpdateNode.py index 28a04131..b20d3c55 100644 --- a/PLC/Methods/UpdateNode.py +++ b/PLC/Methods/UpdateNode.py @@ -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(): diff --git a/PLC/Methods/UpdateNodeGroup.py b/PLC/Methods/UpdateNodeGroup.py index 5d31026e..78042bee 100644 --- a/PLC/Methods/UpdateNodeGroup.py +++ b/PLC/Methods/UpdateNodeGroup.py @@ -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 diff --git a/PLC/Methods/UpdateNodeNetwork.py b/PLC/Methods/UpdateNodeNetwork.py index 3936e3de..dc1e65ad 100644 --- a/PLC/Methods/UpdateNodeNetwork.py +++ b/PLC/Methods/UpdateNodeNetwork.py @@ -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())) diff --git a/PLC/Methods/UpdatePCU.py b/PLC/Methods/UpdatePCU.py index 1c915acd..89166843 100644 --- a/PLC/Methods/UpdatePCU.py +++ b/PLC/Methods/UpdatePCU.py @@ -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 diff --git a/PLC/Methods/UpdatePeer.py b/PLC/Methods/UpdatePeer.py index dd5f2c8b..8586a48a 100644 --- a/PLC/Methods/UpdatePeer.py +++ b/PLC/Methods/UpdatePeer.py @@ -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 diff --git a/PLC/Methods/UpdatePerson.py b/PLC/Methods/UpdatePerson.py index 594f1ff6..816f98e7 100644 --- a/PLC/Methods/UpdatePerson.py +++ b/PLC/Methods/UpdatePerson.py @@ -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: diff --git a/PLC/Methods/UpdateSite.py b/PLC/Methods/UpdateSite.py index e46582ad..2e4d95de 100644 --- a/PLC/Methods/UpdateSite.py +++ b/PLC/Methods/UpdateSite.py @@ -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())) diff --git a/PLC/Methods/UpdateSlice.py b/PLC/Methods/UpdateSlice.py index 357a10f6..2596c740 100644 --- a/PLC/Methods/UpdateSlice.py +++ b/PLC/Methods/UpdateSlice.py @@ -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 diff --git a/PLC/Methods/UpdateSliceAttribute.py b/PLC/Methods/UpdateSliceAttribute.py index 5b7d48fb..80122ac0 100644 --- a/PLC/Methods/UpdateSliceAttribute.py +++ b/PLC/Methods/UpdateSliceAttribute.py @@ -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 diff --git a/PLC/Methods/UpdateSliceAttributeType.py b/PLC/Methods/UpdateSliceAttributeType.py index a6c77014..145a51da 100644 --- a/PLC/Methods/UpdateSliceAttributeType.py +++ b/PLC/Methods/UpdateSliceAttributeType.py @@ -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 diff --git a/PLC/Methods/VerifyPerson.py b/PLC/Methods/VerifyPerson.py index 3f1591a5..fd4adb72 100644 --- a/PLC/Methods/VerifyPerson.py +++ b/PLC/Methods/VerifyPerson.py @@ -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 \ -- 2.45.2