Fix enabled log_exchange issue

If log_exchange is enabled, it fails to load v2 app.

This patch fixes this issue by initializing debug middleware
after setup_app method as 'Debug' middleware expects global_conf
type as dict instead of 'pecan.conf' which doesn't have copy method.

Change-Id: I65742b261b7b1429b399a78d19cdaf85ef28b917
Closes-Bug: #1803037
This commit is contained in:
asmita singh 2018-11-19 07:05:17 +00:00 committed by Asmita Singh
parent 7ee3c800ea
commit 64caeb6bae
1 changed files with 3 additions and 4 deletions

View File

@ -55,10 +55,6 @@ def setup_app(pecan_config=None, extra_hooks=None):
guess_content_type_from_ext=False
)
# WSGI middleware for debugging
if CONF.log_exchange:
app = debug.Debug.factory(pecan_config)(app)
# WSGI middleware for Keystone auth
# NOTE(sbauza): ACLs are always active unless for unittesting where
# enable_acl could be set to False
@ -78,4 +74,7 @@ def make_app():
}
# NOTE(sbauza): Fill Pecan config and call modules' path app.setup_app()
app = pecan.load_app(config)
# WSGI middleware for debugging
if CONF.log_exchange:
app = debug.Debug.factory(config)(app)
return app