Capture the stdout and stderr buffers from plugin invocation and report them with the error messages in containerd when the unmarshalling of JSON fails. Also, stop reporting the plugin name twice, adjacent to each other (where possible).
Sample error messages with the changes in the PR:
Overall execution error when the plugin binary could not be executed - stdout/stderr of plugin is irrelevant and therefore skipped:
containerd: time="2020-12-20T04:33:05.811689116Z" level=error msg="RunPodSandbox for &PodSandboxMetadata{Name:ddebroy-busybox,Uid:30078379-5ae5-4e9c-bc2e-87230e52d13f,Namespace:dev-ddebroy,Attempt:0,} failed, error" error="nri invoke: plugin: testplugin: exec: \"testplugin\": executable file not found in $PATH"
Plugin error from execution of the plugin (non zero exit code) that could not be unmarshalled - stdout and stderr dumped:
Capture the stdout and stderr buffers from plugin invocation and report them with the error messages in containerd when the unmarshalling of JSON fails. Also, stop reporting the plugin name twice, adjacent to each other (where possible).
Sample error messages with the changes in the PR:
Signed-off-by: Deep Debroy ddebroy@apple.com