Use module path to load wsgi application

devstack is now replacing usage of wsgi script by wsgi module. This
replaces the way to load the api wsgi app following that transition.

Change-Id: Id799bacb71483d2e337c049e1db7f85735eb5a1e
This commit is contained in:
Takashi Kajinami 2024-11-26 10:58:22 +09:00
parent 347d3a8fef
commit ecf76ae7d7
2 changed files with 25 additions and 12 deletions

View File

@ -7,7 +7,7 @@ ZAQAR_CONF_DIR=/etc/zaqar
ZAQAR_CONF=$ZAQAR_CONF_DIR/zaqar.conf
ZAQAR_POLICY_CONF=$ZAQAR_CONF_DIR/policy.yaml
ZAQAR_UWSGI_CONF=$ZAQAR_CONF_DIR/uwsgi.conf
ZAQAR_UWSGI=$ZAQAR_DIR/zaqar/transport/wsgi/app.py
ZAQAR_UWSGI=zaqar.transport.wsgi.app:application
ZAQAR_API_LOG_DIR=/var/log/zaqar
ZAQAR_API_LOG_FILE=$ZAQAR_API_LOG_DIR/queues.log
ZAQAR_AUTH_CACHE_DIR=${ZAQAR_AUTH_CACHE_DIR:-/var/cache/zaqar}

View File

@ -26,6 +26,8 @@ no common way to specify / pass configuration files
to the WSGI app when it is called from other apps.
"""
import threading
from oslo_config import cfg
from oslo_log import log
from oslo_reports import guru_meditation_report as gmr
@ -35,16 +37,27 @@ from zaqar import bootstrap
from zaqar import version
# Use the global CONF instance
conf = cfg.CONF
gmr_opts.set_defaults(conf)
log.register_options(conf)
conf(project='zaqar', prog='zaqar-queues', args=[])
log.setup(conf, 'zaqar')
CONF = cfg.CONF
gmr.TextGuruMeditation.setup_autorun(version, conf=conf)
boot = bootstrap.Bootstrap(conf)
conf.drivers.transport = 'wsgi'
application = boot.transport.app
# Keep the old name for compatibility
app = application
def init_application():
gmr_opts.set_defaults(CONF)
log.register_options(CONF)
CONF(project='zaqar', prog='zaqar-queues', args=[])
log.setup(CONF, 'zaqar')
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
boot = bootstrap.Bootstrap(CONF)
CONF.drivers.transport = 'wsgi'
return boot.transport.app
app = application = None
lock = threading.Lock()
with lock:
if application is None:
application = init_application()
# Keep the old name for compatibility
app = application