Closed richm closed 1 year ago
Patch and project coverage have no change.
Comparison is base (
9986937
) 54.92% compared to head (9bfb005
) 54.92%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
[citest]
[citest]
[citest]
ok - tests look good - I can verify locally that check mode appears to be working
for testing check mode:
tox -e qemu-ansible-core-2.15 -- --image-name centos-9 --log-level debug --debug -- tests/tests_default.yml
this will ensure packages and services are present and leave the vm running
ansible-playbook -vv -i /tmp/inventory-cloudxxxxx/inventory --check tests/tests_check_mode.yml
find the tmp inventory, then use that to run ansible-playbook against the running vm using check mode
pkill -f standard-inventory
kill the vm and clean up resources when done
Works well for me but a test like this fails with the same error as in #151:
---
- hosts: all
become: true
gather_facts: false
tasks:
- name: Install firewalld
ansible.builtin.include_role:
name: linux-system-roles.firewall
- name: Enter check mode
check_mode: true
block:
- name: Previous replaced
ansible.builtin.include_role:
name: linux-system-roles.firewall
vars:
firewall:
- previous: replaced
This test seems to fail, making a suggestion now to fix that, though I'm not sure why it seems to not fail with ansible-playbook --check
set
Cause: The role was not checking to see if any files would be changed when using
previous: replaced
in check mode. The variables that should have been set were not set in check mode.Consequence: The role would give an error about undefined variables.
Fix: A new check has been added for check mode, to see if any files would be changed by
previous: replaced
. The check forfirewalld.conf
looks at the rpm database to determine if the file has been changed from the version shipped in the package. If files would not be changed by usingprevious: replaced
, then the role will also now correctly report if any settings would be changed.Result: The role works in check mode when using
previous: replaced
Signed-off-by: Rich Megginson rmeggins@redhat.com