diff options
author | Matt Martz <matt@sivel.net> | 2022-01-18 19:33:41 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 17:33:41 -0800 |
commit | 83d7716e02f78685509337efc8dbbd7212020b22 (patch) | |
tree | 0553740b6a98522d47c081ac52367a2209752cb3 | |
parent | 3edae9b3e8327ac9030a822ecc383b95de322cf9 (diff) | |
download | ansible-83d7716e02f78685509337efc8dbbd7212020b22.tar.gz |
[stable-2.12] Compare FQCN also in lockstep logic. Fixes #76782 (#76787) (#76791)
(cherry picked from commit 29bdb8b)
Co-authored-by: Matt Martz <matt@sivel.net>
4 files changed, 42 insertions, 1 deletions
diff --git a/changelogs/fragments/76782-fqcn-compare-lockstep-strategies.yml b/changelogs/fragments/76782-fqcn-compare-lockstep-strategies.yml new file mode 100644 index 0000000000..fd0d21240c --- /dev/null +++ b/changelogs/fragments/76782-fqcn-compare-lockstep-strategies.yml @@ -0,0 +1,4 @@ +bugfixes: +- default callback - Ensure we compare FQCN also in lockstep logic, to ensure + using the FQCN of a strategy plugin triggers the correct behavior in the + default callback plugin. (https://github.com/ansible/ansible/issues/76782) diff --git a/lib/ansible/plugins/callback/default.py b/lib/ansible/plugins/callback/default.py index 56d6531593..0e47970392 100644 --- a/lib/ansible/plugins/callback/default.py +++ b/lib/ansible/plugins/callback/default.py @@ -24,6 +24,7 @@ from ansible import context from ansible.playbook.task_include import TaskInclude from ansible.plugins.callback import CallbackBase from ansible.utils.color import colorize, hostcolor +from ansible.utils.fqcn import add_internal_fqcns # These values use ansible.constants for historical reasons, mostly to allow # unmodified derivative plugins to work. However, newer options added to the @@ -176,7 +177,7 @@ class CallbackModule(CallbackBase): # Preserve task name, as all vars may not be available for templating # when we need it later - if self._play.strategy in ('free', 'host_pinned'): + if self._play.strategy in add_internal_fqcns(('free', 'host_pinned')): # Explicitly set to None for strategy free/host_pinned to account for any cached # task title from a previous non-free play self._last_task_name = None diff --git a/test/integration/targets/callback_default/callback_default.out.fqcn_free.stdout b/test/integration/targets/callback_default/callback_default.out.fqcn_free.stdout new file mode 100644 index 0000000000..0ec0447978 --- /dev/null +++ b/test/integration/targets/callback_default/callback_default.out.fqcn_free.stdout @@ -0,0 +1,35 @@ + +PLAY [nonlockstep] ************************************************************* + +TASK [command] ***************************************************************** +changed: [testhost10] + +TASK [command] ***************************************************************** +changed: [testhost10] + +TASK [command] ***************************************************************** +changed: [testhost10] + +TASK [command] ***************************************************************** +changed: [testhost11] + +TASK [command] ***************************************************************** +changed: [testhost11] + +TASK [command] ***************************************************************** +changed: [testhost11] + +TASK [command] ***************************************************************** +changed: [testhost12] + +TASK [command] ***************************************************************** +changed: [testhost12] + +TASK [command] ***************************************************************** +changed: [testhost12] + +PLAY RECAP ********************************************************************* +testhost10 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 +testhost11 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 +testhost12 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 + diff --git a/test/integration/targets/callback_default/runme.sh b/test/integration/targets/callback_default/runme.sh index f9b60b6ba3..50b4cf703b 100755 --- a/test/integration/targets/callback_default/runme.sh +++ b/test/integration/targets/callback_default/runme.sh @@ -211,4 +211,5 @@ rm -f meta_test.out # Ensure free/host_pinned non-lockstep strategies display correctly diff -u callback_default.out.free.stdout <(ANSIBLE_STRATEGY=free ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null) +diff -u callback_default.out.fqcn_free.stdout <(ANSIBLE_STRATEGY=ansible.builtin.free ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null) diff -u callback_default.out.host_pinned.stdout <(ANSIBLE_STRATEGY=host_pinned ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null) |