jscheffl commented on code in PR #59819:
URL: https://github.com/apache/airflow/pull/59819#discussion_r2648146798
##########
airflow-core/src/airflow/configuration.py:
##########
@@ -647,7 +654,15 @@ def get_airflow_config(airflow_home: str) -> str:
def get_all_expansion_variables() -> dict[str, Any]:
- return {k: v for d in [globals(), locals()] for k, v in d.items() if not
k.startswith("_")}
Review Comment:
Note for this: Previously this generated a lot of "garbage" from functions
and imports but on the other hand the function did not have any locals().
Looked like this:
{'annotations': _Feature((3, 7, 0, 'beta', 1), None, 16777216),
'contextlib': <module 'contextlib' from
'/usr/python/lib/python3.12/contextlib.py'>, 'logging': <module 'logging' from
'/usr/python/lib/python3.12/logging/__init__.py'>, 'multiprocessing': <module
'multiprocessing' from
'/usr/python/lib/python3.12/multiprocessing/__init__.py'>, 'os': <module 'os'
(frozen)>, 'pathlib': <module 'pathlib' from
'/usr/python/lib/python3.12/pathlib.py'>, 're': <module 're' from
'/usr/python/lib/python3.12/re/__init__.py'>, 'shlex': <module 'shlex' from
'/usr/python/lib/python3.12/shlex.py'>, 'stat': <module 'stat' (frozen)>,
'subprocess': <module 'subprocess' from
'/usr/python/lib/python3.12/subprocess.py'>, 'sys': <module 'sys' (built-in)>,
'warnings': <module 'warnings' from '/usr/python/lib/python3.12/warnings.py'>,
'b64encode': <function b64encode at 0x7e739c122480>, 'Callable': <class
'collections.abc.Callable'>, 'ConfigParser': <class
'configparser.ConfigParser'>, 'deepcopy': <functio
n deepcopy at 0x7e739c472ac0>, 'StringIO': <class '_io.StringIO'>, 'Pattern':
<class 're.Pattern'>, 'IO': <class 'typing.IO'>, 'TYPE_CHECKING': False, 'Any':
typing.Any, 'urlsplit': <functools._lru_cache_wrapper object at
0x7e739c3f41a0>, 'overload': <function overload at 0x7e739c251120>,
'VALUE_NOT_FOUND_SENTINEL': <airflow._shared.configuration.parser.ValueNotFound
object at 0x7e739a1e3d70>, 'ValueNotFound': <class
'airflow._shared.configuration.parser.ValueNotFound'>, 'import_string':
<function import_string at 0x7e7399de1800>, 'AirflowConfigException': <class
'airflow._shared.configuration.exceptions.AirflowConfigException'>,
'DEFAULT_SECRETS_SEARCH_PATH':
['airflow.secrets.environment_variables.EnvironmentVariablesBackend',
'airflow.secrets.metastore.MetastoreBackend'], 'WeightRule': <enum
'WeightRule'>, 'yaml': <module 'airflow.utils.yaml' from
'/opt/airflow/airflow-core/src/airflow/utils/yaml.py'>, 'log': <Logger
airflow.configuration (INFO)>, 'ConfigType': str | int | float
| bool, 'ConfigOptionsDictType': dict[str, str | int | float | bool],
'ConfigSectionSourcesType': dict[str, str | tuple[str, str]],
'ConfigSourcesType': dict[str, dict[str, str | tuple[str, str]]],
'ENV_VAR_PREFIX': 'AIRFLOW__', 'ConfigModifications': <class
'airflow.configuration.ConfigModifications'>, 'expand_env_var': <function
expand_env_var at 0x7e7392b9e160>, 'run_command': <function run_command at
0x7e7390c67ba0>, 'retrieve_configuration_description': <function
retrieve_configuration_description at 0x7e7390c67ce0>, 'AirflowConfigParser':
<class 'airflow.configuration.AirflowConfigParser'>, 'get_airflow_home':
<function get_airflow_home at 0x7e7390c67d80>, 'get_airflow_config': <function
get_airflow_config at 0x7e7392f70e00>, 'get_all_expansion_variables': <function
get_all_expansion_variables at 0x7e7392f70ea0>, 'create_default_config_parser':
<function create_default_config_parser at 0x7e7392f70fe0>,
'create_provider_config_fallback_defaults': <function create_provider_confi
g_fallback_defaults at 0x7e7392f71080>,
'write_default_airflow_configuration_if_needed': <function
write_default_airflow_configuration_if_needed at 0x7e7392f71120>,
'load_standard_airflow_configuration': <function
load_standard_airflow_configuration at 0x7e7392f711c0>, 'initialize_config':
<function initialize_config at 0x7e7392f71260>,
'make_group_other_inaccessible': <function make_group_other_inaccessible at
0x7e7392f71300>, 'ensure_secrets_loaded': <function ensure_secrets_loaded at
0x7e7392f713a0>, 'get_custom_secret_backend': <function
get_custom_secret_backend at 0x7e7392f71440>, 'initialize_secrets_backends':
<function initialize_secrets_backends at 0x7e7392f714e0>,
'initialize_auth_manager': <function initialize_auth_manager at
0x7e7392f71580>, 'AIRFLOW_HOME': '/root/airflow', 'AIRFLOW_CONFIG':
'/root/airflow/airflow.cfg', 'TEST_DAGS_FOLDER': '/root/airflow/dags',
'TEST_PLUGINS_FOLDER': '/root/airflow/plugins', 'SECRET_KEY':
'HAOQMGu7Djo0PFoTLWOlJQ==', 'FERNET_KEY': '', 'JW
T_SECRET_KEY': ''}
With the change the replacement dict is:
{'FERNET_KEY': None, 'JWT_SECRET_KEY': None, 'annotations': _Feature((3, 7,
0, 'beta', 1), None, 16777216), 'TYPE_CHECKING': False,
'VALUE_NOT_FOUND_SENTINEL': <airflow._shared.configuration.parser.ValueNotFound
object at 0x71f23b36fd40>, 'DEFAULT_SECRETS_SEARCH_PATH':
['airflow.secrets.environment_variables.EnvironmentVariablesBackend',
'airflow.secrets.metastore.MetastoreBackend'], 'log': <Logger
airflow.configuration (INFO)>, 'ConfigType': str | int | float | bool,
'ENV_VAR_PREFIX': 'AIRFLOW__', 'AIRFLOW_HOME': '/root/airflow',
'AIRFLOW_CONFIG': '/root/airflow/airflow.cfg', 'TEST_DAGS_FOLDER':
'/root/airflow/dags', 'TEST_PLUGINS_FOLDER': '/root/airflow/plugins',
'SECRET_KEY': '27Ya3l5fnWYS0ebuYltsFg=='}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]