Merge "Allow pecan debug middleware to be turned off"

This commit is contained in:
Jenkins 2014-09-18 08:17:17 +00:00 committed by Gerrit Code Review
commit 1ac00d4a70
2 changed files with 14 additions and 9 deletions

View File

@ -40,8 +40,17 @@ auth_opts = [
),
]
api_opts = [
cfg.BoolOpt('pecan_debug',
default='$debug',
help='Toggle Pecan Debug Middleware. '
'Defaults to global debug value.'
),
]
CONF = cfg.CONF
CONF.register_opts(auth_opts)
CONF.register_opts(api_opts, group='api')
def get_pecan_config():
@ -70,7 +79,7 @@ def setup_app(pecan_config=None, extra_hooks=None):
pecan_config.app.root,
static_root=pecan_config.app.static_root,
template_path=pecan_config.app.template_path,
debug=CONF.debug,
debug=CONF.api.pecan_debug,
force_canonical=getattr(pecan_config.app, 'force_canonical', True),
hooks=app_hooks,
wrap_app=middleware.ParsableErrorMiddleware,
@ -83,7 +92,7 @@ def setup_app(pecan_config=None, extra_hooks=None):
class VersionSelectorApplication(object):
def __init__(self):
pc = get_pecan_config()
pc.app.debug = CONF.debug
pc.app.debug = CONF.api.pecan_debug
def not_found(environ, start_response):
start_response('404 Not Found', [])

View File

@ -60,10 +60,6 @@ Limitation
As Ceilometer is using Pecan and Pecan's DebugMiddleware doesn't support
multiple processes, there is no way to set debug mode in the multiprocessing
case. So user will run into HTTP 500 error if the mod_wsgi's multiprocessing
is enabled and the Ceilometer debug mode is enabled at the same time. There
is no good way to make both of them work, since Pecan is sharing the debug
mode with Ceilometer, see[1]. If you really need to enable both, a possible
workaround is hacking that line and hardcode the debug configration to False.
[1] https://github.com/openstack/ceilometer/blob/master/ceilometer/api/app.py
case. To allow multiple processes the DebugMiddleware may be turned off by
setting ``pecan_debug`` to ``False`` in the ``api`` section of
``ceilometer.conf``.