From 13ff99e2db71a786aac856bc9eba3712e82ddee3 Mon Sep 17 00:00:00 2001 From: Miguel Rodriguez Gutierrez Date: Fri, 20 Sep 2024 04:40:59 -0600 Subject: [PATCH] Make credentials loading consistent between `KedroContext._get_catalog()` and catalog CLI (#4165) * Use _get_config_credentials() in catalog CLI Update RELEASE.md Signed-off-by: Miguel Rodriguez Gutierrez * fix tests Signed-off-by: Miguel Rodriguez Gutierrez * fix test Signed-off-by: Miguel Rodriguez Gutierrez --------- Signed-off-by: Miguel Rodriguez Gutierrez --- RELEASE.md | 3 +++ kedro/framework/cli/catalog.py | 2 +- tests/framework/cli/test_catalog.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index f2f24f9a77..88f900bcec 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -9,6 +9,8 @@ ## Bug fixes and other changes * Fixed bug where using dataset factories breaks with `ThreadRunner`. * Fixed template projects example tests. +* Made credentials loading consistent between `KedroContext._get_catalog()` and `resolve_patterns` so that both us +e `_get_config_credentials()` ## Breaking changes to the API * Removed `ShelveStore` to address a security vulnerability. @@ -21,6 +23,7 @@ * [Puneet](https://github.com/puneeter) * [ethanknights](https://github.com/ethanknights) * [Manezki](https://github.com/Manezki) +* [MigQ2](https://github.com/MigQ2) # Release 0.19.8 diff --git a/kedro/framework/cli/catalog.py b/kedro/framework/cli/catalog.py index 7bd0197e5b..c1a485b74a 100644 --- a/kedro/framework/cli/catalog.py +++ b/kedro/framework/cli/catalog.py @@ -227,7 +227,7 @@ def resolve_patterns(metadata: ProjectMetadata, env: str) -> None: context = session.load_context() catalog_config = context.config_loader["catalog"] - credentials_config = context.config_loader.get("credentials", None) + credentials_config = context._get_config_credentials() data_catalog = DataCatalog.from_config( catalog=catalog_config, credentials=credentials_config ) diff --git a/tests/framework/cli/test_catalog.py b/tests/framework/cli/test_catalog.py index 7a61c9e7a0..8905da9c94 100644 --- a/tests/framework/cli/test_catalog.py +++ b/tests/framework/cli/test_catalog.py @@ -543,6 +543,7 @@ def test_catalog_resolve( "catalog": fake_catalog_config, "credentials": fake_credentials_config, } + mocked_context._get_config_credentials.return_value = fake_credentials_config mocked_context.catalog = DataCatalog.from_config( catalog=fake_catalog_config, credentials=fake_credentials_config )