Files
Thomas Goirand aedd2fef0a SSHAction: Add return_result_on_error=True/False
Currently, if an SSHAction is launched, and the target script returns
with non-zero, the execution will be set to ERROR, and we can see in
the "execution output show":

"The action raised an exception
[action=<mistral.actions.std_actions.SSHAction object at 0x1234>,
action_ex_id=<UUID>, msg='Failed to execute ssh cmd
'/path/to/command param1 param2' on ['hostname']']"

That's not at all helpful for debugging, as the command stdout
and stderr aren't accessible anymore. One may want to have the ssh
output instead, and see what went wrong.

This patch adds a return_result_on_error new param to have the
feature (and to keep backward compatibility). When this is set,
when an SSH command is launched correctly, but returns non-zero,
the output will contain the stdout, stderr and return code.
Because of Mistral's design, the workflow execusion task cannot
be en ERROR, otherwise stdout/stderr/exit_code are overwritten
by Mistral exception. Therefore, if one wants to still have the
workflow execution in error, the exit code must be looked-up
later in the workflow. Lookup in the doc change included in
this patch.

Signed-off-by: Thomas Goirand <zigo@debian.org>
Change-Id: If71f5663c26457a5cf6b9eb88f15355e664b520e
2025-10-15 15:45:54 +02:00
..
2023-01-18 18:02:03 +01:00