Merge pull request #5407 from AlanCoding/depgrades_2019_party

General dependency upgrades (awx venv only for now)

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-01-10 18:44:21 +00:00
committed by GitHub
31 changed files with 405 additions and 398 deletions

View File

@@ -24,31 +24,18 @@ except ImportError: # pragma: no cover
import hashlib
try:
import django
from django.db.backends.base import schema
from django.db.backends.utils import names_digest
import django # noqa: F401
HAS_DJANGO = True
except ImportError:
HAS_DJANGO = False
else:
from django.db.backends.base import schema
from django.db.backends.utils import names_digest
if HAS_DJANGO is True:
# 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 operating in a FIPS environment, `hashlib.md5()` will raise a `ValueError`,
# but will support the `usedforsecurity` keyword on RHEL and Centos systems.
# Keep an eye on https://code.djangoproject.com/ticket/28401
target_version = '2.2.4'
if django.__version__ != target_version:
raise RuntimeError(
"Django version other than {target} detected: {current}. "
"Overriding `names_digest` is known to work for Django {target} "
"and may not work in other Django versions.".format(target=target_version,
current=django.__version__)
)
# See upgrade blocker note in requirements/README.md
try:
names_digest('foo', 'bar', 'baz', length=8)
except ValueError:

View File

@@ -310,6 +310,9 @@ REST_FRAMEWORK = {
'VIEW_DESCRIPTION_FUNCTION': 'awx.api.generics.get_view_description',
'NON_FIELD_ERRORS_KEY': '__all__',
'DEFAULT_VERSION': 'v2',
# For swagger schema generation
# see https://github.com/encode/django-rest-framework/pull/6532
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema',
#'URL_FORMAT_OVERRIDE': None,
}

View File

@@ -20,17 +20,7 @@ class SocialAuthMiddleware(SocialAuthExceptionMiddleware):
def process_request(self, request):
if request.path.startswith('/sso'):
# django-social keeps a list of backends in memory that it gathers
# based on the value of settings.AUTHENTICATION_BACKENDS *at import
# time*:
# https://github.com/python-social-auth/social-app-django/blob/c1e2795b00b753d58a81fa6a0261d8dae1d9c73d/social_django/utils.py#L13
#
# our settings.AUTHENTICATION_BACKENDS can *change*
# dynamically as Tower settings are changed (i.e., if somebody
# configures Github OAuth2 integration), so we need to
# _overwrite_ this in-memory value at the top of every request so
# that we have the latest version
# see: https://github.com/ansible/tower/issues/1979
# See upgrade blocker note in requirements/README.md
utils.BACKENDS = settings.AUTHENTICATION_BACKENDS
token_key = request.COOKIES.get('token', '')
token_key = urllib.parse.quote(urllib.parse.unquote(token_key).strip('"'))

View File

@@ -34,11 +34,6 @@ if MODE == 'production':
logger.error("Missing or incorrect metadata for Tower version. Ensure Tower was installed using the setup playbook.")
raise Exception("Missing or incorrect metadata for Tower version. Ensure Tower was installed using the setup playbook.")
if social_django.__version__ != '2.1.0':
raise RuntimeError("social_django version other than 2.1.0 detected {}. \
Confirm that per-request social_django.utils.BACKENDS override \
still works".format(social_django.__version__))
# Return the default Django WSGI application.
application = get_wsgi_application()