[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>
pull/76830/head
Matt Martz 3 years ago committed by GitHub
parent ea1f2269cd
commit b4c1688809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -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

@ -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

@ -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)

Loading…
Cancel
Save