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

pull/60122/head
Matt Martz 5 years ago committed by GitHub
parent be24db8886
commit df6b8d2a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -62,7 +62,7 @@ class CallbackModule(CallbackBase):
color = C.COLOR_OK color = C.COLOR_OK
state = 'SUCCESS' 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) self._display.display(self._command_generic_msg(result._host.get_name(), result._result, state), color=color)
else: else:
self._display.display("%s | %s => %s" % (result._host.get_name(), state, self._dump_results(result._result, indent=4)), color=color) self._display.display("%s | %s => %s" % (result._host.get_name(), state, self._dump_results(result._result, indent=4)), color=color)

@ -64,7 +64,7 @@ class CallbackModule(CallbackBase):
color = C.COLOR_OK color = C.COLOR_OK
state = 'SUCCESS' 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) self._display.display(self._command_generic_msg(result._host.get_name(), result._result, state), color=color)
else: else:
self._display.display("%s | %s => %s" % (result._host.get_name(), state, self._dump_results(result._result, indent=0).replace('\n', '')), self._display.display("%s | %s => %s" % (result._host.get_name(), state, self._dump_results(result._result, indent=0).replace('\n', '')),

Loading…
Cancel
Save