From d5f65dd97a7bb990ab1f84190ade2c14d59433ec Mon Sep 17 00:00:00 2001 From: jakub-nt <175944085+jakub-nt@users.noreply.github.com> Date: Fri, 20 Jun 2025 17:04:43 +0200 Subject: [PATCH] Do not display skipping module add messages if the module is not specified by the user Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com> --- cfbs/cfbs_config.py | 3 ++- tests/shell/041_add_multidep.sh | 21 +++++++++++++++++++++ tests/shell/all.sh | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/shell/041_add_multidep.sh diff --git a/cfbs/cfbs_config.py b/cfbs/cfbs_config.py index ad3a825f..606cf871 100644 --- a/cfbs/cfbs_config.py +++ b/cfbs/cfbs_config.py @@ -104,7 +104,8 @@ def add_with_dependencies( name = module["name"] assert "steps" in module if self._module_is_in_build(module): - print("Skipping already added module '%s'" % name) + if is_module_added_manually(str_added_by): + print("Skipping already added module '%s'" % name) return if "dependencies" in module: for dep in module["dependencies"]: diff --git a/tests/shell/041_add_multidep.sh b/tests/shell/041_add_multidep.sh new file mode 100644 index 00000000..22578051 --- /dev/null +++ b/tests/shell/041_add_multidep.sh @@ -0,0 +1,21 @@ +set -e +set -x +cd tests/ +mkdir -p ./tmp/ +cd ./tmp/ +touch cfbs.json && rm cfbs.json +rm -rf .git + +cfbs --non-interactive init + +cfbs --non-interactive add https://github.com/cfengine/test-cfbs-static-repo > output.log 2>&1 + +# All four modules were correctly added +grep -F "Added module: test-library-parsed-local-users" ./output.log +grep -F "Added module: test-library-parsed-etc-group" ./output.log +grep -F "Added module: test-inventory-local-groups" ./output.log +grep -F "Added module: test-inventory-local-users" ./output.log + +# Adding modules together with their dependencies should not display skipping messages (CFE-3841): +! ( grep -F "Skipping already added" ./output.log ) + diff --git a/tests/shell/all.sh b/tests/shell/all.sh index 58a2fe48..71d92ee5 100644 --- a/tests/shell/all.sh +++ b/tests/shell/all.sh @@ -44,5 +44,6 @@ bash tests/shell/037_cfbs_validate.sh bash tests/shell/038_global_dir.sh bash tests/shell/039_add_added_by_field_update_1.sh bash tests/shell/040_add_added_by_field_update_2.sh +bash tests/shell/041_add_multidep.sh echo "All cfbs shell tests completed successfully!"