Browse Source

[Stable only] Fix callback function arguments

Fixes [1] and [2] for bug [3] are using new callabacks mechanism and
expects payload as one of the arguments passed to the callback functions.
This works fine in Xena+ releases but not in Wallaby and olders where
old callbacks mechanism is still used, at least for the security group
AFTER_DELETE events.
So this patch fixes that by changing to the old callbacks mechanism in
the logging service plugin in stable/wallaby and older branches only.

Closes-Bug: #1955546

[1] https://review.opendev.org/c/openstack/neutron/+/804237
[2] https://review.opendev.org/c/openstack/neutron/+/812459
[3] https://bugs.launchpad.net/neutron/+bug/1939558

Change-Id: I0003bd566dc769436ad1342351ad058394bd52da
changes/11/822611/1
Slawek Kaplonski 5 months ago
parent
commit
eb1190d206
  1. 6
      neutron/services/logapi/logging_plugin.py

6
neutron/services/logapi/logging_plugin.py

@ -58,9 +58,11 @@ class LoggingPlugin(log_ext.LoggingPluginBase):
self.delete_log(context, log['id'])
@registry.receives(resources.SECURITY_GROUP, [events.AFTER_DELETE])
def _clean_logs_by_resource_id(self, resource, event, trigger, payload):
def _clean_logs_by_resource_id(self, resource, event, trigger, **kwargs):
# log.resource_id == SG
self._clean_logs(payload.context.elevated(), sg_id=payload.resource_id)
context = kwargs['context']
sg_id = kwargs['security_group_id']
self._clean_logs(context.elevated(), sg_id=sg_id)
@registry.receives(resources.PORT, [events.AFTER_DELETE])
def _clean_logs_by_target_id(self, resource, event, trigger, **kwargs):

Loading…
Cancel
Save