Fix for bug related to async jid polling change plus a new test

This commit is contained in:
James Cammarata 2014-03-26 15:48:42 -05:00
parent 88462729aa
commit 78bdb078fe
2 changed files with 16 additions and 2 deletions

View file

@ -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', {})

View file

@ -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"