Add wsgi module

The wsgi_script feature is being removed because of some changes in
underlying python packaging tooling. This makes aodh to vendor the wsgi
module which can be used instead of the wsgi script, according to
the proposed community goal[1]. The existing wsgi scripts are kept now
for smooth transition.

The exsiting app.wsgi file is deprecated in favor of the new wsgi
module to follow the standard pattern to vendor the wsgi module.

[1] https://review.opendev.org/c/openstack/governance/+/902807

Change-Id: I7ce471c7fbce960ba92bfd18203a73454088314e
This commit is contained in:
Takashi Kajinami 2024-11-26 10:50:32 +09:00
parent 97e7362624
commit f7aa502e3c
4 changed files with 27 additions and 1 deletions

View File

@ -19,5 +19,9 @@
See http://pecan.readthedocs.org/en/latest/deployment.html for details.
"""
from aodh.api import app
import warnings
warnings.warn('Using app.wsgi is deprecated. Use aodh.wsgi.api instead')
application = app.build_wsgi_app(argv=[])

0
aodh/wsgi/__init__.py Normal file
View File

22
aodh/wsgi/api.py Normal file
View File

@ -0,0 +1,22 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""WSGI application entry-point for Aodh API."""
import threading
from aodh.api import app
application = None
with threading.Lock():
if application is None:
application = app.build_wsgi_app(argv=[])

View File

@ -11,7 +11,7 @@ AODH_DIR=$DEST/aodh
AODH_CONF_DIR=/etc/aodh
AODH_CONF=$AODH_CONF_DIR/aodh.conf
AODH_UWSGI_CONF=$AODH_CONF_DIR/aodh-uwsgi.ini
AODH_UWSGI=$AODH_DIR/aodh/api/app.wsgi
AODH_UWSGI=aodh.wsgi.api:application
# Set up database backend
AODH_BACKEND=${AODH_BACKEND:-mysql}