diff --git a/awx/settings/__init__.py b/awx/settings/__init__.py index 5883ac92f814..0b2739bde1a4 100644 --- a/awx/settings/__init__.py +++ b/awx/settings/__init__.py @@ -5,6 +5,7 @@ factory, export, load_envvars, + load_python_file_with__injected_context, load_standard_settings_files, validate, ) @@ -46,8 +47,12 @@ settings_dir = os.environ.get('AWX_SETTINGS_DIR', '/etc/tower/conf.d/') settings_files_path = os.path.join(settings_dir, '*.py') settings_file_path = os.environ.get('AWX_SETTINGS_FILE', '/etc/tower/settings.py') -DYNACONF.load_file(settings_file_path) -DYNACONF.load_file(settings_files_path) + +# The following should have been loaded using `DYNACONF.load_file` but we are +# using `load_python_file_with__injected_context` to maintain backwards compatibility +load_python_file_with__injected_context(settings_files_path, settings=DYNACONF) +load_python_file_with__injected_context(settings_file_path, settings=DYNACONF) + # Load new standard settings files from # /etc/ansible-automation-platform/ and /etc/ansible-automation-platform/awx/ @@ -56,9 +61,9 @@ # Load optional development only settings if DYNACONF.get_environ("AWX_KUBE_DEVEL"): - DYNACONF.load_file("kube_defaults.py") + load_python_file_with__injected_context("kube_defaults.py", settings=DYNACONF) else: - DYNACONF.load_file("local_*.py") + load_python_file_with__injected_context("local_*.py", settings=DYNACONF) # Check at least one required setting file has been loaded if "production" in DYNACONF.current_env.lower(): # pragma: no cover