mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
fix a bug in the display of playbooks using serial or free strategy
This commit is contained in:
@@ -19,6 +19,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
import codecs
|
import codecs
|
||||||
|
import collections
|
||||||
import contextlib
|
import contextlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -66,6 +67,7 @@ class BaseCallbackModule(CallbackBase):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(BaseCallbackModule, self).__init__()
|
super(BaseCallbackModule, self).__init__()
|
||||||
self.task_uuids = set()
|
self.task_uuids = set()
|
||||||
|
self.duplicate_task_counts = collections.defaultdict(lambda: 1)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def capture_event_data(self, event, **event_data):
|
def capture_event_data(self, event, **event_data):
|
||||||
@@ -229,10 +231,19 @@ class BaseCallbackModule(CallbackBase):
|
|||||||
# FIXME: Flag task path output as vv.
|
# FIXME: Flag task path output as vv.
|
||||||
task_uuid = str(task._uuid)
|
task_uuid = str(task._uuid)
|
||||||
if task_uuid in self.task_uuids:
|
if task_uuid in self.task_uuids:
|
||||||
# FIXME: When this task UUID repeats, it means the play is using the
|
# When this task UUID repeats, it means the play is using the
|
||||||
# free strategy, so different hosts may be running different tasks
|
# free strategy (or serial:1) so different hosts may be running
|
||||||
# within a play.
|
# different tasks within a play (where duplicate UUIDS are common).
|
||||||
return
|
#
|
||||||
|
# When this is the case, modify the UUID slightly to append
|
||||||
|
# a counter so we can still _track_ duplicate events, but also
|
||||||
|
# avoid breaking the display in these scenarios.
|
||||||
|
self.duplicate_task_counts[task_uuid] += 1
|
||||||
|
|
||||||
|
task_uuid = '_'.join([
|
||||||
|
task_uuid,
|
||||||
|
str(self.duplicate_task_counts[task_uuid])
|
||||||
|
])
|
||||||
self.task_uuids.add(task_uuid)
|
self.task_uuids.add(task_uuid)
|
||||||
self.set_task(task)
|
self.set_task(task)
|
||||||
event_data = dict(
|
event_data = dict(
|
||||||
|
|||||||
Reference in New Issue
Block a user