From a3f9c0b012e56ee62e8f4aec7162c7c320dffdec Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Tue, 13 Nov 2018 15:02:52 -0500 Subject: [PATCH] warn about FIPS mode if the Django version changes --- awx/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/awx/__init__.py b/awx/__init__.py index 1d0eb212d2..9ae88153e5 100644 --- a/awx/__init__.py +++ b/awx/__init__.py @@ -22,11 +22,21 @@ except ImportError: # pragma: no cover import hashlib +import django from django.utils.encoding import force_bytes from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.base import schema +# This line exists to make sure we don't regress on FIPS support if we +# upgrade Django; if you're upgrading Django and see this error, +# update the version check below, and confirm that FIPS still works. +if django.__version__ != '1.11.16': + raise RuntimeError("Django version other than 1.11.16 detected {}. \ + Subclassing BaseDatabaseSchemaEditor is known to work for Django 1.11.16 \ + and may not work in newer Django versions.".format(django.__version__)) + + class FipsBaseDatabaseSchemaEditor(BaseDatabaseSchemaEditor): @classmethod