Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes problem where conf variable was used before initialization #16088

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions airflow/configuration.py
Expand Up @@ -873,9 +873,6 @@ def initialize_config():

log.info('Creating new FAB webserver config file in: %s', WEBSERVER_CONFIG)
shutil.copy(_default_config_file_path('default_webserver_config.py'), WEBSERVER_CONFIG)

conf.validate()

return conf


Expand Down Expand Up @@ -1114,6 +1111,7 @@ def __getattr__(name):

conf = initialize_config()
secrets_backend_list = initialize_secrets_backends()
conf.validate()


PY37 = sys.version_info >= (3, 7)
Expand Down
3 changes: 2 additions & 1 deletion tests/www/views/test_views.py
Expand Up @@ -44,7 +44,8 @@ def test_configuration_do_not_expose_config(admin_client):
@mock.patch.dict(os.environ, {"AIRFLOW__CORE__UNIT_TEST_MODE": "False"})
def test_configuration_expose_config(admin_client):
# make sure config is initialized (without unit test mote)
initialize_config()
conf = initialize_config()
conf.validate()
with conf_vars({('webserver', 'expose_config'): 'True'}):
resp = admin_client.get('configuration', follow_redirects=True)
check_content_in_response(['Airflow Configuration', 'Running Configuration'], resp)
Expand Down