[stable-only] "_clean_logs_by_target_id" to use old notifications

"LoggingPlugin._clean_logs_by_resource_id" method receives PORT,
AFTER_DELETE events, in the old format (not using payloads but
kwargs). New implementation was added in Xena release.

Closes-Bug: #1954666
Change-Id: I736fef3a10bc2887efb26c95e9fc1eea14969ccf
(cherry picked from commit aaa0e99bac)
This commit is contained in:
Rodolfo Alonso Hernandez 2021-12-13 13:53:47 +00:00
parent 45db6b45e1
commit d384849918
1 changed files with 4 additions and 3 deletions

View File

@ -63,10 +63,11 @@ class LoggingPlugin(log_ext.LoggingPluginBase):
self._clean_logs(payload.context.elevated(), sg_id=payload.resource_id)
@registry.receives(resources.PORT, [events.AFTER_DELETE])
def _clean_logs_by_target_id(self, resource, event, trigger, payload):
def _clean_logs_by_target_id(self, resource, event, trigger, **kwargs):
# log.target_id == port
self._clean_logs(payload.context.elevated(),
port_id=payload.resource_id)
context = kwargs['context']
port_id = kwargs['port']['id']
self._clean_logs(context.elevated(), port_id=port_id)
@db_base_plugin_common.filter_fields
@db_base_plugin_common.convert_result_to_dict