-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Force loading provider configuration when using config.as_dict #38793
Conversation
It's not clear to me why the sensitive_config_values excludes providers when config.as_dict is used on the webserver. This has resulted in displaying sensitive provider configurations even when non-sensitive-only is used as the value of [webserver]expose_config. This fixed it but still, it's not clear to me where things went wrong.
@@ -1439,11 +1439,13 @@ def as_dict( | |||
("default", self._default_values), | |||
("airflow.cfg", self), | |||
] | |||
# Force the providers configuration to be loaded | |||
self.configuration_description = retrieve_configuration_description() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.configuration_description = retrieve_configuration_description() | |
if not self.configuration_description: | |
self.configuration_description = retrieve_configuration_description() |
perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s there just that it doesn’t have providers configuration. so this would lead to old results.
where it was set initially, it was set not to load providers configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Probably needs a comment then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or rather, expanding on the comment you did add 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not the right fix (it will cause much slowe airflow import if we do it this way because importing airflow is initializing configuraiton (this is why by default it does not load provider configuration).
We are lazy-loading provider's configuration by ProvidersManager.iniitialize_providers_configuration(). I have a fix coming with modified tests. I noticed that teh test that was retrieving config for non-sensitive values was not really testing if configuration for non-sensitive values was working - it checked only if as_dict() was called with include_sensitive=False (but it did not really check if sensitive values were replaced).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a test to cover that this doesn't break again please? |
Better fix: #38795 |
It's not clear to me why the sensitive_config_values excludes providers when config.as_dict is used on the webserver. This has resulted in displaying sensitive provider configurations even when non-sensitive-only is used as the value of [webserver]expose_config.
This fixed it but still, it's not clear to me where things went wrong.
cc @potiuk