1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #3773 from cchurch/devel

Update callbacks used for async tasks
This commit is contained in:
Michael DeHaan 2013-08-06 13:32:53 -07:00
commit 4cbfe3be57
2 changed files with 5 additions and 2 deletions

View file

@ -277,7 +277,7 @@ class PlayBook(object):
# since these likely got killed by async_wrapper
for host in poller.hosts_to_poll:
reason = { 'failed' : 1, 'rc' : None, 'msg' : 'timed out' }
self.runner_callbacks.on_failed(host, reason)
self.runner_callbacks.on_async_failed(host, reason, poller.jid)
results['contacted'][host] = reason
return results
@ -319,6 +319,9 @@ class PlayBook(object):
if task.async_poll_interval > 0:
# if not polling, playbook requested fire and forget, so don't poll
results = self._async_poll(poller, task.async_seconds, task.async_poll_interval)
else:
for (host, res) in results.get('contacted', {}).iteritems():
self.runner_callbacks.on_async_ok(host, res, poller.jid)
contacted = results.get('contacted',{})
dark = results.get('dark', {})

View file

@ -73,7 +73,7 @@ class AsyncPoller(object):
else:
self.results['contacted'][host] = res
poll_results['contacted'][host] = res
if 'failed' in res:
if res.get('failed', False) or res.get('rc', 0) != 0:
self.runner.callbacks.on_async_failed(host, res, self.jid)
else:
self.runner.callbacks.on_async_ok(host, res, self.jid)