Fix async output with adhoc callbacks. Fixes #15988 (#59935)

This commit is contained in:
Matt Martz 2019-08-05 10:36:41 -05:00 committed by GitHub
parent be24db8886
commit df6b8d2a4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- async - Fix async callback plugins to allow async output to be displayed
when running command/shell (https://github.com/ansible/ansible/issues/15988)

View file

@ -62,7 +62,7 @@ class CallbackModule(CallbackBase):
color = C.COLOR_OK
state = 'SUCCESS'
if result._task.action in C.MODULE_NO_JSON:
if result._task.action in C.MODULE_NO_JSON and 'ansible_job_id' not in result._result:
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, state), color=color)
else:
self._display.display("%s | %s => %s" % (result._host.get_name(), state, self._dump_results(result._result, indent=4)), color=color)

View file

@ -64,7 +64,7 @@ class CallbackModule(CallbackBase):
color = C.COLOR_OK
state = 'SUCCESS'
if result._task.action in C.MODULE_NO_JSON:
if result._task.action in C.MODULE_NO_JSON and 'ansible_job_id' not in result._result:
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, state), color=color)
else:
self._display.display("%s | %s => %s" % (result._host.get_name(), state, self._dump_results(result._result, indent=0).replace('\n', '')),