Skip to content

Commit bef9451

Browse files
committed
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>
1 parent faed0ba commit bef9451

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

cfbs/cfbs_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def add_with_dependencies(
104104
name = module["name"]
105105
assert "steps" in module
106106
if self._module_is_in_build(module):
107-
print("Skipping already added module '%s'" % name)
107+
if is_module_added_manually(str_added_by):
108+
print("Skipping already added module '%s'" % name)
108109
return
109110
if "dependencies" in module:
110111
for dep in module["dependencies"]:

tests/shell/041_add_multidep.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
set -e
2+
set -x
3+
cd tests/
4+
mkdir -p ./tmp/
5+
cd ./tmp/
6+
touch cfbs.json && rm cfbs.json
7+
rm -rf .git
8+
9+
cfbs --non-interactive init
10+
11+
cfbs --non-interactive add https://github.com/cfengine/test-cfbs-static-repo > output.log 2>&1
12+
13+
# All four modules were correctly added
14+
grep -F "Added module: test-library-parsed-local-users" ./output.log
15+
grep -F "Added module: test-library-parsed-etc-group" ./output.log
16+
grep -F "Added module: test-inventory-local-groups" ./output.log
17+
grep -F "Added module: test-inventory-local-users" ./output.log
18+
19+
# Adding modules together with their dependencies should not display skipping messages (CFE-3841):
20+
! ( grep -F "Skipping already added" ./output.log )
21+

tests/shell/all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ bash tests/shell/037_cfbs_validate.sh
4444
bash tests/shell/038_global_dir.sh
4545
bash tests/shell/039_add_added_by_field_update_1.sh
4646
bash tests/shell/040_add_added_by_field_update_2.sh
47+
bash tests/shell/041_add_multidep.sh
4748

4849
echo "All cfbs shell tests completed successfully!"

0 commit comments

Comments
 (0)