1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

warn about FIPS mode if the Django version changes

This commit is contained in:
Ryan Petrello 2018-11-13 15:02:52 -05:00
parent cceac8d907
commit a3f9c0b012
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -22,11 +22,21 @@ except ImportError: # pragma: no cover
import hashlib import hashlib
import django
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.base import schema 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): class FipsBaseDatabaseSchemaEditor(BaseDatabaseSchemaEditor):
@classmethod @classmethod