diff --git a/ceilometer/api/app.py b/ceilometer/api/app.py index 9067eaf15..8e8b22eda 100644 --- a/ceilometer/api/app.py +++ b/ceilometer/api/app.py @@ -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', []) diff --git a/doc/source/install/mod_wsgi.rst b/doc/source/install/mod_wsgi.rst index 950978ba0..2defcb53a 100644 --- a/doc/source/install/mod_wsgi.rst +++ b/doc/source/install/mod_wsgi.rst @@ -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``.