Build RequestContext in webhook middleware
Build a RequestContext based on the senlin context which is got using context.get_service_context. This RequestContext object will be used by webhook middleware to access DB API. Change-Id: I49c66b22c748a96fec4b67e0be9315628500aefd
This commit is contained in:
parent
34278063ef
commit
6c21cab0bc
|
@ -68,8 +68,13 @@ class WebhookMiddleware(wsgi.Middleware):
|
|||
# Get the credential stored in DB based on webhook ID.
|
||||
# TODO(Anyone): Use Barbican to store these credential.
|
||||
LOG.debug(_("Get credential of webhook %(id)s"), webhook_id)
|
||||
senlin_context = context.get_service_context()
|
||||
webhook_obj = webhooks.Webhook.load(senlin_context, webhook_id)
|
||||
senlin_context = context.RequestContext.get_service_context()
|
||||
# Build a RequestContext from senlin_context since DB API
|
||||
# needs the session parameter.
|
||||
# TODO(Anyone): This converting is not needed any more after
|
||||
# the context redesign is finally complete.
|
||||
ctx = context.RequestContext(**senlin_context)
|
||||
webhook_obj = webhooks.Webhook.load(ctx, webhook_id)
|
||||
credential = webhook_obj.credential
|
||||
credential['webhook_id'] = webhook_id
|
||||
if 'auth_url' not in credential:
|
||||
|
|
Loading…
Reference in New Issue