Add "raw" module output to job-output.txt
The "raw" Ansible module produces stdout and stderr like the other shell modules. Add its output to the job-output.txt file. (Note that streaming output is not available since that requires the cooperation of a module which defeats the purpose of "raw".) Change-Id: I77feefcbb08b244ab58cacf5c1f3b77a3803599b
This commit is contained in:
@ -73,6 +73,9 @@
|
||||
set_fact:
|
||||
testfile: "/tmp/testfile-{{ zuul.build }}"
|
||||
|
||||
- name: Test raw module
|
||||
raw: /bin/sh -c 'echo Testing raw'
|
||||
|
||||
handlers:
|
||||
- name: test handler
|
||||
command: echo "This is a handler"
|
||||
|
@ -265,6 +265,7 @@ class FunctionalZuulStreamMixIn:
|
||||
r"""compute1 \| ok: \{'string': '\d.""", text)
|
||||
self.assertLogLine(
|
||||
r'fake \| skipping: Conditional result was False', text)
|
||||
self.assertLogLine(r'compute1 \| Testing raw', text)
|
||||
|
||||
def test_command_split_streams(self):
|
||||
job = self._run_job('command', split=True)
|
||||
|
@ -554,15 +554,18 @@ class CallbackModule(default.CallbackModule):
|
||||
|
||||
if not is_localhost and is_task:
|
||||
self._stop_streamers()
|
||||
if result._task.action in ('command', 'shell',
|
||||
if result._task.action in ('raw', 'command', 'shell',
|
||||
'win_command', 'win_shell',
|
||||
'ansible.builtin.raw',
|
||||
'ansible.windows.win_command',
|
||||
'ansible.windows.win_shell'):
|
||||
stdout_lines = zuul_filter_result(result_dict)
|
||||
# We don't have streaming for localhost and windows modules so get
|
||||
# standard out after the fact.
|
||||
if is_localhost or result._task.action in (
|
||||
'win_command', 'win_shell', 'ansible.windows.win_command',
|
||||
'raw', 'win_command', 'win_shell',
|
||||
'ansible.builtin.raw',
|
||||
'ansible.windows.win_command',
|
||||
'ansible.windows.win_shell'):
|
||||
for line in stdout_lines:
|
||||
hostname = self._get_hostname(result)
|
||||
@ -747,8 +750,9 @@ class CallbackModule(default.CallbackModule):
|
||||
|
||||
if to_text(result_dict.get('msg', '')).startswith('MODULE FAILURE'):
|
||||
self._log_module_failure(result, result_dict)
|
||||
elif result._task.action not in ('command', 'shell',
|
||||
elif result._task.action not in ('raw', 'command', 'shell',
|
||||
'win_command', 'win_shell',
|
||||
'ansible.builtin.raw',
|
||||
'ansible.windows.win_command',
|
||||
'ansible.windows.win_shell'):
|
||||
if 'msg' in result_dict:
|
||||
@ -792,8 +796,9 @@ class CallbackModule(default.CallbackModule):
|
||||
|
||||
if to_text(result_dict.get('msg', '')).startswith('MODULE FAILURE'):
|
||||
self._log_module_failure(result, result_dict)
|
||||
elif result._task.action not in ('command', 'shell',
|
||||
elif result._task.action not in ('raw', 'command', 'shell',
|
||||
'win_command', 'win_shell',
|
||||
'ansible.builtin.raw',
|
||||
'ansible.windows.win_command',
|
||||
'ansible.windows.win_shell'):
|
||||
self._log_message(
|
||||
|
Reference in New Issue
Block a user