From f73de11acc12c28b4195d87fd028f4aef8ff8672 Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Fri, 11 Jun 2021 11:23:10 -0400 Subject: [PATCH 1/2] introduced a pre-flight check for postgres 12 --- awx/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/awx/__init__.py b/awx/__init__.py index b9cc01174f..ab22dcb4a8 100644 --- a/awx/__init__.py +++ b/awx/__init__.py @@ -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,11 @@ 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 (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 From 7a130a06160250335e31bfe1477bb2d19c10e41b Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Mon, 14 Jun 2021 13:55:11 -0400 Subject: [PATCH 2/2] flipped MODE switch for postgres check --- awx/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/__init__.py b/awx/__init__.py index ab22dcb4a8..35322396b3 100644 --- a/awx/__init__.py +++ b/awx/__init__.py @@ -151,9 +151,10 @@ def manage(): 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 (connection.pg_version // 10000) < 12: - sys.stderr.write("Postgres version 12 is required\n") - sys.exit(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__)