mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 16:28:43 -03:30
Sanity check for tower version metadata file in wsgi bootstrap
This commit is contained in:
14
awx/wsgi.py
14
awx/wsgi.py
@@ -14,6 +14,20 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
|
|||||||
from awx import prepare_env
|
from awx import prepare_env
|
||||||
prepare_env()
|
prepare_env()
|
||||||
|
|
||||||
|
import os
|
||||||
|
import logging
|
||||||
|
from django.conf import settings
|
||||||
|
from awx import __version__ as tower_version
|
||||||
|
logger = logging.getLogger('awx.main.models.jobs')
|
||||||
|
try:
|
||||||
|
fd = open("/var/lib/awx/.tower_version", "r")
|
||||||
|
if fd.read().strip() != tower_version:
|
||||||
|
logger.error("Tower Versions don't match, potential invalid setup detected")
|
||||||
|
raise Exception("Tower Versions don't match, potential invalid setup detected")
|
||||||
|
except Exception:
|
||||||
|
logger.error("Missing tower version metadata at /var/lib/awx/.tower_version")
|
||||||
|
raise Exception("Missing tower version metadata at /var/lib/awx/.tower_version")
|
||||||
|
|
||||||
# Return the default Django WSGI application.
|
# Return the default Django WSGI application.
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|||||||
Reference in New Issue
Block a user