mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix for bug related to async jid polling change plus a new test
This commit is contained in:
parent
88462729aa
commit
78bdb078fe
2 changed files with 16 additions and 2 deletions
|
@ -304,7 +304,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_async_failed(host, reason, poller.jid)
|
||||
self.runner_callbacks.on_async_failed(host, reason, poller.runner.setup_cache[host]['ansible_job_id'])
|
||||
results['contacted'][host] = reason
|
||||
|
||||
return results
|
||||
|
@ -375,7 +375,7 @@ class PlayBook(object):
|
|||
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)
|
||||
self.runner_callbacks.on_async_ok(host, res, poller.runner.setup_cache[host]['ansible_job_id'])
|
||||
|
||||
contacted = results.get('contacted',{})
|
||||
dark = results.get('dark', {})
|
||||
|
|
|
@ -43,3 +43,17 @@
|
|||
- "'stdout_lines' in async_result"
|
||||
- "async_result.rc == 0"
|
||||
|
||||
- name: test async without polling
|
||||
command: sleep 5
|
||||
async: 30
|
||||
poll: 0
|
||||
register: async_result
|
||||
|
||||
- debug: var=async_result
|
||||
|
||||
- name: validate async without polling returns
|
||||
assert:
|
||||
that:
|
||||
- "'ansible_job_id' in async_result"
|
||||
- "'started' in async_result"
|
||||
- "'finished' not in async_result"
|
||||
|
|
Loading…
Reference in a new issue