diff options
author | Boden R <bodenvmw@gmail.com> | 2017-12-14 14:12:34 -0700 |
---|---|---|
committer | garyk <gkotton@vmware.com> | 2017-12-24 07:27:11 +0000 |
commit | 3f1a9846d23198f4a89f89bac73ba80ef201dea0 (patch) | |
tree | bd2feb23d2a394157dcb119001c32949cb8a3896 /neutron/pecan_wsgi | |
parent | 2bfc219e88379443b5f8d404d8f98044e0bc9069 (diff) | |
download | neutron-3f1a9846d23198f4a89f89bac73ba80ef201dea0.tar.gz |
use callback payloads for REQUEST/RESPONSE events
This patch switches callbacks over to the payload object style events
[1] for BEFORE_RESPONSE and AFTER_REQUEST based notifications. To do
so an APIEventPayload object is used with the publish() method to
pass along the API related data. In addition a few UTs are updated to
work with the changes.
NeutronLibImpact
[1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html#event-payloads
Change-Id: Ibd8559e0db9dcc995abf8937a0cb764b21a18531
Diffstat (limited to 'neutron/pecan_wsgi')
-rw-r--r-- | neutron/pecan_wsgi/hooks/notifier.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/neutron/pecan_wsgi/hooks/notifier.py b/neutron/pecan_wsgi/hooks/notifier.py index cc32adedfa..f9167e910b 100644 --- a/neutron/pecan_wsgi/hooks/notifier.py +++ b/neutron/pecan_wsgi/hooks/notifier.py @@ -98,10 +98,12 @@ class NotifierHook(hooks.PecanHook): notifier_method = '%s.%s.end' % (resource_name, action) notifier_action = utils.get_controller(state).plugin_handlers[action] - registry.notify(resource_name, events.BEFORE_RESPONSE, self, - context=neutron_context, data=result, - method_name=notifier_method, action=notifier_action, - collection=collection_name, original=original) + registry.publish(resource_name, events.BEFORE_RESPONSE, self, + payload=events.APIEventPayload( + neutron_context, notifier_method, notifier_action, + request_body=state.request.body, + states=(original, result,), + collection_name=collection_name)) if action == 'delete': resource_id = state.request.context.get('resource_id') |