Skip to content
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

Remove double Ansible logs #237

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions scripts/qesap/lib/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,9 @@ def cmd_ansible(configure_data, base_project, dryrun, verbose, destroy=False, pr
if dryrun:
print(' '.join(command['cmd']))
else:
ret, out = lib.process_manager.subprocess_run(**command)
ret, _ = lib.process_manager.subprocess_run(**command)
log.debug("Ansible process return ret:%d", ret)
if ret == 0:
for out_line in out:
log.debug("> %s", out_line)
else:
if ret != 0:
log.error("command:%s returned non zero %d", command, ret)
return Status(ret)
return Status("ok")
15 changes: 11 additions & 4 deletions scripts/qesap/test/e2e/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ echo "#######################################################################"
test_step "Configure has to fail with empty yaml"
set +e
qesap.py --verbose -b ${QESAPROOT} -c test_1.yaml configure
rc=$?;echo "1"; [[ $rc -ne 0 ]] || test_die "Should exit with zero rc but is rc:$rc"
rc=$?; [[ $rc -ne 0 ]] || test_die "Should exit with zero rc but is rc:$rc"
set -e

test_step "Minimal configure only with Terraform"
Expand Down Expand Up @@ -155,7 +155,7 @@ test_step "[test_5.yaml] test verbosity for terraform PASS"
rm terraform.*.log.txt
set +e
qesap.py -b ${QESAPROOT} -c test_5.yaml terraform |& tee "${QESAPROOT}/test_5_terraform.txt"
qesap.py --verbose -b ${QESAPROOT} -c test_5.yaml configure |& tee "${QESAPROOT}/test_5_terraform_verbose.txt"
qesap.py --verbose -b ${QESAPROOT} -c test_5.yaml terraform |& tee "${QESAPROOT}/test_5_terraform_verbose.txt"
grep -qE "^DEBUG" "${QESAPROOT}/test_5_terraform_verbose.txt"
rc=$?; [[ $rc -eq 0 ]] || test_die "rc:$rc in verbose mode there should be some DEBUG"

Expand All @@ -178,6 +178,13 @@ echo "### ###"
echo "### A N S I B L E ###"
echo "### ###"
echo "#######################################################################"
test_step "[test_4.yaml] Run Ansible without inventory"
rm "${TEST_PROVIDER}/inventory.yaml" || echo "No old inventory to remove"
set +e
qesap.py --verbose -b ${QESAPROOT} -c test_4.yaml ansible
rc=$?; [[ $rc -ne 0 ]] || test_die "qesap.py ansible has to fail without inventory.yaml but rc:$rc"
set -e

test_step "[test_3.yaml] Run Ansible with no playbooks"
# Keep in mind that test_3.yaml has no playbooks at all
touch "${TEST_PROVIDER}/inventory.yaml"
Expand Down Expand Up @@ -211,7 +218,7 @@ grep -qE "^INFO" "${QESAPROOT}/test_4_ansible_pass_verbose.txt"
rc=$?; [[ $rc -eq 0 ]] || test_die "rc:$rc in verbose mode there should be some INFO"

occurrence=$(grep -E "TASK \[Say hello\]" "${QESAPROOT}/test_4_ansible_pass_verbose.txt" | wc -l)
[[ $occurrence -eq 1 ]] || echo "Some Ansible stdout lines are repeated ${occurrence} in place of exactly 1"
[[ $occurrence -eq 1 ]] || test_die "Some Ansible stdout lines are repeated ${occurrence} times in place of exactly 1"
set -e
rm "${QESAPROOT}/test_4_ansible_pass.txt"
rm "${QESAPROOT}/test_4_ansible_pass_verbose.txt"
rm "${QESAPROOT}/test_4_ansible_pass_verbose.txt"
Loading