mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Flush handlers before pre and post task sections change, but not between task and roles, as this seems
to be confusing to people (and not usually neccessary)
This commit is contained in:
parent
6fdfbb1a34
commit
21fe750cef
2 changed files with 7 additions and 4 deletions
|
@ -224,9 +224,9 @@ class PlayBook(object):
|
|||
|
||||
# if we have matched_tags, the play must be run.
|
||||
# if the play contains no tasks, assume we just want to gather facts
|
||||
# in this case there are actually 4 meta tasks (handler flushes) not 0
|
||||
# tasks, so that's why there's a check against 4.
|
||||
if (len(matched_tags) > 0 or len(play.tasks()) == 4):
|
||||
# in this case there are actually 3 meta tasks (handler flushes) not 0
|
||||
# tasks, so that's why there's a check against 3
|
||||
if (len(matched_tags) > 0 or len(play.tasks()) == 3):
|
||||
plays.append(play)
|
||||
|
||||
# if the playbook is invoked with --tags that don't exist at all in the playbooks
|
||||
|
|
|
@ -140,6 +140,8 @@ class Play(object):
|
|||
pre_tasks = []
|
||||
for x in pre_tasks:
|
||||
new_tasks.append(x)
|
||||
|
||||
# flush handlers after pre_tasks
|
||||
new_tasks.append(dict(meta='flush_handlers'))
|
||||
|
||||
# variables if the role was parameterized (i.e. given as a hash)
|
||||
|
@ -201,10 +203,11 @@ class Play(object):
|
|||
if type(post_tasks) != list:
|
||||
post_tasks = []
|
||||
|
||||
new_tasks.append(dict(meta='flush_handlers'))
|
||||
new_tasks.extend(tasks)
|
||||
# flush handlers after tasks + role tasks
|
||||
new_tasks.append(dict(meta='flush_handlers'))
|
||||
new_tasks.extend(post_tasks)
|
||||
# flush handlers after post tasks
|
||||
new_tasks.append(dict(meta='flush_handlers'))
|
||||
new_handlers.extend(handlers)
|
||||
new_vars_files.extend(vars_files)
|
||||
|
|
Loading…
Reference in a new issue