Allow pecan debug middleware to be turned off
The Pecan DebugMiddleware is turned on or off based on the ceilometer.conf-wide debug setting. This is not useful for situations where running ceilometer-api under mod_wsgi with multiple processes is desired. This change adds a pecan_debug setting to the api section of config, defaulting to the DEFAULT debug value. mod_wsgi install docs updated accordingly. Configuration docs have not yet been udpated. They will be pending a fix to bug 1370030 Closes-Bug: #1370009 Change-Id: Ib4a472e3c8d1f34f64a5f3ab993c1211dee8af9a
This commit is contained in:
parent
85b859f42f
commit
8691ba8086
@ -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 = cfg.CONF
|
||||||
CONF.register_opts(auth_opts)
|
CONF.register_opts(auth_opts)
|
||||||
|
CONF.register_opts(api_opts, group='api')
|
||||||
|
|
||||||
|
|
||||||
def get_pecan_config():
|
def get_pecan_config():
|
||||||
@ -70,7 +79,7 @@ def setup_app(pecan_config=None, extra_hooks=None):
|
|||||||
pecan_config.app.root,
|
pecan_config.app.root,
|
||||||
static_root=pecan_config.app.static_root,
|
static_root=pecan_config.app.static_root,
|
||||||
template_path=pecan_config.app.template_path,
|
template_path=pecan_config.app.template_path,
|
||||||
debug=CONF.debug,
|
debug=CONF.api.pecan_debug,
|
||||||
force_canonical=getattr(pecan_config.app, 'force_canonical', True),
|
force_canonical=getattr(pecan_config.app, 'force_canonical', True),
|
||||||
hooks=app_hooks,
|
hooks=app_hooks,
|
||||||
wrap_app=middleware.ParsableErrorMiddleware,
|
wrap_app=middleware.ParsableErrorMiddleware,
|
||||||
@ -83,7 +92,7 @@ def setup_app(pecan_config=None, extra_hooks=None):
|
|||||||
class VersionSelectorApplication(object):
|
class VersionSelectorApplication(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pc = get_pecan_config()
|
pc = get_pecan_config()
|
||||||
pc.app.debug = CONF.debug
|
pc.app.debug = CONF.api.pecan_debug
|
||||||
|
|
||||||
def not_found(environ, start_response):
|
def not_found(environ, start_response):
|
||||||
start_response('404 Not Found', [])
|
start_response('404 Not Found', [])
|
||||||
|
@ -60,10 +60,6 @@ Limitation
|
|||||||
|
|
||||||
As Ceilometer is using Pecan and Pecan's DebugMiddleware doesn't support
|
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
|
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
|
case. To allow multiple processes the DebugMiddleware may be turned off by
|
||||||
is enabled and the Ceilometer debug mode is enabled at the same time. There
|
setting ``pecan_debug`` to ``False`` in the ``api`` section of
|
||||||
is no good way to make both of them work, since Pecan is sharing the debug
|
``ceilometer.conf``.
|
||||||
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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user