Fix using FQCN for flush_handlers (#79057)

Fixes #79023
pull/79071/head
Martin Krizek 2 years ago committed by GitHub
parent f8f1c6a6b5
commit e1daaae42a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "handlers - fix an issue where the ``flush_handlers`` meta task could not be used with FQCN: ``ansible.builtin.meta`` (https://github.com/ansible/ansible/issues/79023)"

@ -118,7 +118,7 @@ class StrategyModule(StrategyBase):
# once hosts synchronize on 'flush_handlers' lockstep enters
# '_in_handlers' phase where handlers are run instead of tasks
# until at least one host is in IteratingStates.HANDLERS
if (not self._in_handlers and cur_task.action == 'meta' and
if (not self._in_handlers and cur_task.action in C._ACTION_META and
cur_task.args.get('_raw_params') == 'flush_handlers'):
self._in_handlers = True

@ -166,3 +166,7 @@ ansible-playbook test_flush_handlers_rescue_always.yml -i inventory.handlers "$@
[ "$(grep out.txt -ce 'rescue ran')" = "1" ]
[ "$(grep out.txt -ce 'always ran')" = "2" ]
[ "$(grep out.txt -ce 'should run for both hosts')" = "2" ]
ansible-playbook test_fqcn_meta_flush_handlers.yml -i inventory.handlers "$@" 2>&1 | tee out.txt
grep out.txt -e "handler ran"
grep out.txt -e "after flush"

@ -0,0 +1,14 @@
- hosts: A
gather_facts: false
tasks:
- command: echo
notify: handler
- ansible.builtin.meta: flush_handlers
- debug:
msg: after flush
handlers:
- name: handler
debug:
msg: handler ran
Loading…
Cancel
Save