mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Merge pull request #10425 from sarabrajsingh/bugfix/preflight-check-postgres-version-4940
introduced a pre-flight check for postgres 12 SUMMARY Introduced a pre-flight check to check the version of Postgres 12 before the application starts - ansible/tower#4940 ISSUE TYPE Bugfix Pull Request COMPONENT NAME API AWX VERSION awx: 19.2.0 Reviewed-by: Alan Rominger <arominge@redhat.com> Reviewed-by: Sarabraj Singh <singh.sarabraj@gmail.com> Reviewed-by: Christian Adams <rooftopcellist@gmail.com> Reviewed-by: Shane McDonald <me@shanemcd.com>
This commit is contained in:
commit
395af1b5e4
@ -34,6 +34,7 @@ else:
|
||||
from django.db.backends.base import schema
|
||||
from django.db.models import indexes
|
||||
from django.db.backends.utils import names_digest
|
||||
from django.db import connection
|
||||
|
||||
|
||||
if HAS_DJANGO is True:
|
||||
@ -149,6 +150,12 @@ def manage():
|
||||
from django.conf import settings
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
# enforce the postgres version is equal to 12. if not, then terminate program with exit code of 1
|
||||
if not MODE == 'development':
|
||||
if (connection.pg_version // 10000) < 12:
|
||||
sys.stderr.write("Postgres version 12 is required\n")
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) >= 2 and sys.argv[1] in ('version', '--version'): # pragma: no cover
|
||||
sys.stdout.write('%s\n' % __version__)
|
||||
# If running as a user without permission to read settings, display an
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user