1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

fix an nuanced bug which can cause OAuth2 migrations to fail

This commit is contained in:
Ryan Petrello 2019-12-04 08:38:22 -05:00
parent 1f628778bb
commit a0d20a5d50
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -86,6 +86,13 @@ def oauth2_getattribute(self, attr):
# Custom method to override # Custom method to override
# oauth2_provider.settings.OAuth2ProviderSettings.__getattribute__ # oauth2_provider.settings.OAuth2ProviderSettings.__getattribute__
from django.conf import settings from django.conf import settings
val = None
if 'migrate' not in sys.argv:
# certain Django OAuth Toolkit migrations actually reference
# setting lookups for references to model classes (e.g.,
# oauth2_settings.REFRESH_TOKEN_MODEL)
# If we're doing an OAuth2 setting lookup *while running* a migration,
# don't do our usual "Configure Tower in Tower" database setting lookup
val = settings.OAUTH2_PROVIDER.get(attr) val = settings.OAUTH2_PROVIDER.get(attr)
if val is None: if val is None:
val = object.__getattribute__(self, attr) val = object.__getattribute__(self, attr)