Krikri::PluginHelpers::RunCommandFailure
AnsibleModule.run_command's two failure shapes, for plugins that shell out the way Ansible modules do (module.run_command with check_rc):
- An exec that never started (missing or unexecutable binary)
surfaces the caught OSError: rc=errno, empty stdout/stderr,
msg "Error executing command.", the cleaned (space-joined)
command string, and the exception text "[Errno N] <reason>:
b'<exe>'". Ansible 2.19 composes the display header as
"<msg>: <exception str>" from that exception field while the
dumped result keeps the bare msg - krikri's result display
mirrors that whenever a failed result carries a real
exceptionvalue (anything but the "(traceback unavailable)" placeholder). - A started exec that exited non-zero under check_rc=True fails with msg=stderr.rstrip() plus cmd/rc/stdout/stderr (and the _lines splits the display adds).
The errno/reason pairs come from the execve failure the module's subprocess.Popen would see: ENOENT (2, "No such file or directory") for a missing file, EACCES (13, "Permission denied") for an existing non-executable one.
Instance methods
Real the Ansible module get_bin_path's ValueError when the binary is nowhere to be found. Real surfaces it as a bare fail_json-style msg (live-verified vs 2.19.11: the fatal msg carries no "Task failed:" chain prefix).
True when exe (an executable override param, used VERBATIM like
Ansible's executable.split(" ") - never a PATH search) would fail
execve. Returns the errno/reason pair it fails with, or nil when
a real subprocess would find and exec it.
exec never started (OSError shape). errno/reason describe the execve failure; exe is the binary path exactly as the module passed it (the b'...' quoting is Python's own errno repr).
Non-zero exit under check_rc=True (the sanitized stderr becomes the msg). basic.py's _return_formatted derives stdout_lines/ stderr_lines from the raw output for every fail_json that carries stdout/stderr - and krikri's fatal dump shows the plugin's raw result, so the helper derives them here (Python str.splitlines semantics, empty output -> []).
ENOENT convenience of #exec_failure.
EACCES convenience of #exec_failure.