This commit is contained in:
parent
d398a4b4f0
commit
0cf4aabc55
2 changed files with 8 additions and 3 deletions
3
changelogs/fragments/23958-cleanup.yml
Normal file
3
changelogs/fragments/23958-cleanup.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
bugfixes:
|
||||
- Ensure if a traceback halts ``strategy.run`` that we still attempt to clean up
|
||||
(https://github.com/ansible/ansible/issues/23958)
|
|
@ -289,14 +289,16 @@ class TaskQueueManager:
|
|||
self._start_at_done = True
|
||||
|
||||
# and run the play using the strategy and cleanup on way out
|
||||
play_return = strategy.run(iterator, play_context)
|
||||
try:
|
||||
play_return = strategy.run(iterator, play_context)
|
||||
finally:
|
||||
strategy.cleanup()
|
||||
self._cleanup_processes()
|
||||
|
||||
# now re-save the hosts that failed from the iterator to our internal list
|
||||
for host_name in iterator.get_failed_hosts():
|
||||
self._failed_hosts[host_name] = True
|
||||
|
||||
strategy.cleanup()
|
||||
self._cleanup_processes()
|
||||
return play_return
|
||||
|
||||
def cleanup(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue