summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2022-01-19 11:10:35 -0600
committerGitHub <noreply@github.com>2022-01-19 11:10:35 -0600
commitb4c1688809366f034a179c7d7c1300fdda136b26 (patch)
tree5bd453a5401723d108b777c78bcf330167dcf61e
parentea1f2269cd81024de86edf003c7734ed58accef6 (diff)
downloadansible-b4c1688809366f034a179c7d7c1300fdda136b26.tar.gz
[stable-2.11] Compare FQCN also in lockstep logic. Fixes #76782 (#76787) (#76797)
(cherry picked from commit 29bdb8b) Co-authored-by: Matt Martz <matt@sivel.net>
-rw-r--r--changelogs/fragments/76782-fqcn-compare-lockstep-strategies.yml4
-rw-r--r--lib/ansible/plugins/callback/default.py3
-rw-r--r--test/integration/targets/callback_default/callback_default.out.fqcn_free.stdout35
-rwxr-xr-xtest/integration/targets/callback_default/runme.sh1
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 0a0eebfd9d..4faaf19d85 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
@@ -188,7 +189,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 b5c98ef72b..898b393248 100755
--- a/test/integration/targets/callback_default/runme.sh
+++ b/test/integration/targets/callback_default/runme.sh
@@ -204,4 +204,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)