Make noop tasks implicit (#71344)

Signed-off-by: Rick Elrod <rick@elrod.me>
Co-authored-by: Rick Elrod <rick@elrod.me>
pull/71357/head
Martin Krizek 4 years ago committed by GitHub
parent f8aa307659
commit 2675768e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,6 +74,7 @@ class StrategyModule(StrategyBase):
self.noop_task = Task()
self.noop_task.action = 'meta'
self.noop_task.args['_raw_params'] = 'noop'
self.noop_task.implicit = True
self.noop_task.set_loader(iterator._play._loader)
return self._create_noop_block_from(original_block, parent)
@ -88,6 +89,7 @@ class StrategyModule(StrategyBase):
noop_task = Task()
noop_task.action = 'meta'
noop_task.args['_raw_params'] = 'noop'
noop_task.implicit = True
noop_task.set_loader(iterator._play._loader)
host_tasks = {}

@ -0,0 +1,11 @@
# This playbooks generates a noop task in the linear strategy, the output is tested that the banner for noop task is not printed https://github.com/ansible/ansible/pull/71344
- hosts: all
gather_facts: no
tasks:
- block:
- name: EXPECTED FAILURE # sate shippable
fail:
when: inventory_hostname == 'host1'
rescue:
- name: rescue
debug:

@ -178,3 +178,9 @@ run_test_dryrun check_nomarkers_wet
# Test the dry run without check markers
run_test_dryrun check_nomarkers_dry --check
# Make sure implicit meta tasks are not printed
ansible-playbook -i host1,host2 no_implicit_meta_banners.yml > meta_test.out
cat meta_test.out
[ "$(grep -c 'TASK \[meta\]' meta_test.out)" -eq 0 ]
rm -f meta_test.out

Loading…
Cancel
Save