mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 22:46:01 -03:30
Get rid of names_digest hack no longer needed (#14459)
This commit is contained in:
@@ -52,39 +52,14 @@ try:
|
|||||||
except ImportError: # pragma: no cover
|
except ImportError: # pragma: no cover
|
||||||
MODE = 'production'
|
MODE = 'production'
|
||||||
|
|
||||||
import hashlib
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import django # noqa: F401
|
import django # noqa: F401
|
||||||
|
|
||||||
HAS_DJANGO = True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_DJANGO = False
|
pass
|
||||||
else:
|
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
|
from django.db import connection
|
||||||
|
|
||||||
if HAS_DJANGO is True:
|
|
||||||
# See upgrade blocker note in requirements/README.md
|
|
||||||
try:
|
|
||||||
names_digest('foo', 'bar', 'baz', length=8)
|
|
||||||
except ValueError:
|
|
||||||
|
|
||||||
def names_digest(*args, length):
|
|
||||||
"""
|
|
||||||
Generate a 32-bit digest of a set of arguments that can be used to shorten
|
|
||||||
identifying names. Support for use in FIPS environments.
|
|
||||||
"""
|
|
||||||
h = hashlib.md5(usedforsecurity=False)
|
|
||||||
for arg in args:
|
|
||||||
h.update(arg.encode())
|
|
||||||
return h.hexdigest()[:length]
|
|
||||||
|
|
||||||
schema.names_digest = names_digest
|
|
||||||
indexes.names_digest = names_digest
|
|
||||||
|
|
||||||
|
|
||||||
def find_commands(management_dir):
|
def find_commands(management_dir):
|
||||||
# Modified version of function from django/core/management/__init__.py.
|
# Modified version of function from django/core/management/__init__.py.
|
||||||
|
|||||||
@@ -59,13 +59,8 @@ for instructions.
|
|||||||
|
|
||||||
If operating in a FIPS environment, `hashlib.md5()` will raise a `ValueError`,
|
If operating in a FIPS environment, `hashlib.md5()` will raise a `ValueError`,
|
||||||
but will support the `usedforsecurity` keyword on RHEL and Centos systems.
|
but will support the `usedforsecurity` keyword on RHEL and Centos systems.
|
||||||
|
This used to be a problem with `names_digest` function in Django, but
|
||||||
Keep an eye on https://code.djangoproject.com/ticket/28401
|
was fixed upstream in Django 4.1.
|
||||||
|
|
||||||
The override of `names_digest` could easily be broken in a future version.
|
|
||||||
Check that the import remains the same in the desired version.
|
|
||||||
|
|
||||||
https://github.com/django/django/blob/af5ec222ccd24e81f9fec6c34836a4e503e7ccf7/django/db/backends/base/schema.py#L7
|
|
||||||
|
|
||||||
### django-split-settings
|
### django-split-settings
|
||||||
|
|
||||||
@@ -172,4 +167,3 @@ available on PyPi with source distribution.
|
|||||||
|
|
||||||
Version 4.8 makes us a little bit nervous with changes to `searchwindowsize` https://github.com/pexpect/pexpect/pull/579/files
|
Version 4.8 makes us a little bit nervous with changes to `searchwindowsize` https://github.com/pexpect/pexpect/pull/579/files
|
||||||
Pin to `pexpect==4.7.x` until we have more time to move to `4.8` and test.
|
Pin to `pexpect==4.7.x` until we have more time to move to `4.8` and test.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user