summaryrefslogtreecommitdiff
path: root/.papr_prepare.sh
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2018-12-02 22:09:34 -0800
committerW. Trevor King <wking@tremily.us>2019-01-08 21:06:17 -0800
commit99e642d9409aef2fadb21546444d3a6a92604124 (patch)
tree490ce40fdae6b792135c3de93ee586314eedfae0 /.papr_prepare.sh
parentc441d51e058e4a0c531f48f7d7269339e6b2d6a1 (diff)
downloadpodman-99e642d9409aef2fadb21546444d3a6a92604124.tar.gz
podman-99e642d9409aef2fadb21546444d3a6a92604124.tar.bz2
podman-99e642d9409aef2fadb21546444d3a6a92604124.zip
pkg/hooks/exec: Include failed command in hook errors
For example: $ cat /etc/containers/oci/hooks.d/test.json { "version": "1.0.0", "hook": { "path": "/bin/sh", "args": ["sh", "-c", "echo 'oh, noes!' >&2; exit 1"] }, "when": { "always": true }, "stages": ["precreate"] } $ podman run --rm docker.io/library/alpine echo 'successful container' error setting up OCI Hooks: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1 The rendered command isn't in in the right syntax for copy/pasting into a shell, but it should be enough for the user to be able to locate the failing hook. They'll need to know their hook directories, but with the previous commits requiring explicit hook directories it's more likely that the caller is aware of them. And if they run at a debug level, they can see the lookups in the logs: $ podman --log-level=debug --hooks-dir=/etc/containers/oci/hooks.d run --rm docker.io/library/alpine echo 'successful container' 2>&1 | grep -i hook time="2018-12-02T22:15:16-08:00" level=debug msg="reading hooks from /etc/containers/oci/hooks.d" time="2018-12-02T22:15:16-08:00" level=debug msg="added hook /etc/containers/oci/hooks.d/test.json" time="2018-12-02T22:15:16-08:00" level=debug msg="hook test.json matched; adding to stages [precreate]" time="2018-12-02T22:15:16-08:00" level=warning msg="container 3695c6ba0cc961918bd3e4a769c52bd08b82afea5cd79e9749e9c7a63b5e7100: precreate hook: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1" time="2018-12-02T22:15:16-08:00" level=error msg="error setting up OCI Hooks: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1" Signed-off-by: W. Trevor King <wking@tremily.us>
Diffstat (limited to '.papr_prepare.sh')
0 files changed, 0 insertions, 0 deletions