Commit 21fe750c by Michael DeHaan

Flush handlers before pre and post task sections change, but not between task…

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)
parent 6fdfbb1a
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment