Commit e38b1c2b authored by Maciej Delmanowski's avatar Maciej Delmanowski

[ci] Check all playbooks for idempotency

Previously the check for playbook idempotency stopped on first found
matching result. However this doesn't work correctly when multiple
playbooks are used during a test. This change should now check all
playbook results for idempotency.
parent 744d54f4
......@@ -400,11 +400,14 @@ sub__ansible__playbook () {
status_msg info "Second Ansible playbook run to test idempotency..."
ansible-playbook "${test_playbooks[@]}" --diff | tee /tmp/ansible_idempotent.txt
if grep -qEm1 -e 'changed=0.*unreachable=0.*failed=0' /tmp/ansible_idempotent.txt ; then
status_msg ok "The playbook is idempotent"
else
# Extract all of the Ansible status lines from the output file and check if
# any of them are not idempotent
if grep -E -e 'ok=.*changed=.*unreachable=.*failed=.*' /tmp/ansible_idempotent.txt \
| grep -v -qE -e 'changed=0.*unreachable=0.*failed=0' ; then
status_msg error "The playbook is NOT IDEMPOTENT"
return 1
else
status_msg ok "The playbook is idempotent"
fi
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment