Fix WSGI application

* Partial revert of 0a82af18ab
  to restore main() method
* Add global `application` variable which will be set by main method to
  problem to preserve the fix from 0a82af18ab.
* Add check for application name starting with '_mod_wsgi' to ensure
  application runs in Devstack as well (Devstack does not use the entry point)
* Modify Devstack plugin to run WSGI entry point rather than app/wsgi.py from
  module directory.

Change-Id: I07001dccb663ed4e6e3347089ab96e6f8ec196d4
Story: 2001197
Task: 5702
This commit is contained in:
Johannes Grassler 2017-09-13 15:27:43 +02:00 committed by Tomasz Trębski
parent df1574ef8c
commit 257fb55635
2 changed files with 13 additions and 4 deletions

View File

@ -258,7 +258,7 @@ function configure_monasca_log_api_wsgi {
fi
# copy proxy vhost and wsgi helper files
sudo cp $MONASCA_LOG_API_DIR/monasca_log_api/app/wsgi.py $MONASCA_LOG_API_WSGI_DIR/monasca_log_api
sudo cp $MONASCA_LOG_API_BIN_DIR/monasca-log-api-wsgi $MONASCA_LOG_API_WSGI_DIR/monasca_log_api
sudo cp $PLUGIN_FILES/apache-log-api.template $monasca_log_api_apache_conf
sudo sed -e "
s|%PUBLICPORT%|$monasca_log_api_api_port|g;

View File

@ -18,6 +18,15 @@ Use this file for deploying the API under mod_wsgi.
from paste import deploy
base_dir = '/etc/monasca/'
conf = '%slog-api-paste.ini' % base_dir
application = deploy.loadapp('config:%s' % conf)
application = None
def main():
base_dir = '/etc/monasca/'
conf = '%slog-api-paste.ini' % base_dir
app = deploy.loadapp('config:%s' % conf)
return app
if __name__ == '__main__' or __name__.startswith('_mod_wsgi'):
application = main()