Fix list index out of range
If the failure occurs on the first task, ansible throws a warning about the call back because it's attempting to set the end time for the previous task which does not exist. Change-Id: Ied1d9cbbfdf61c622a99205bc8a8ea9f2f5e57a5
This commit is contained in:
parent
ba5db95b09
commit
32e4898cf0
|
@ -179,7 +179,8 @@ class CallbackModule(CallbackBase):
|
|||
end_time = current_time()
|
||||
time_elapsed = secondsToStr(time.time() - self.t0)
|
||||
for result in self.results:
|
||||
result['tasks'][-1]['task']['duration']['end'] = end_time
|
||||
if len(result['tasks']) > 1:
|
||||
result['tasks'][-1]['task']['duration']['end'] = end_time
|
||||
result['play']['duration']['end'] = end_time
|
||||
result['play']['duration']['time_elapsed'] = time_elapsed
|
||||
|
||||
|
|
Loading…
Reference in New Issue