[stable-2.8] Fix async output with adhoc callbacks. Fixes #15988 (#59935)

(cherry picked from commit df6b8d2)

Co-authored-by: Matt Martz <matt@sivel.net>
This commit is contained in:
Matt Martz 2019-08-05 10:36:41 -05:00 committed by Toshio Kuratomi
parent 215aa73843
commit 978dd9f541
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', '')),