podman/pkg
W. Trevor King 99e642d940 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>
2019-01-08 21:06:17 -08:00
..
annotations Spell check strings and comments 2018-05-25 08:45:15 +00:00
apparmor pkg/apparmor: use a pipe instead of a tmp file 2018-08-14 14:25:14 +00:00
chrootuser Generate a passwd file for users not in container 2018-10-12 07:08:13 -04:00
criu Add helper function to read out CRIU version 2018-10-23 12:52:03 +02:00
ctime ctime: Drop 32-/64-bit distinction on Linux 2018-07-07 20:35:00 +00:00
firewall Replace existing iptables handler with firewall code 2018-09-10 18:53:27 +00:00
hooks pkg/hooks/exec: Include failed command in hook errors 2019-01-08 21:06:17 -08:00
inspect Switch all referencs to image.ContainerConfig to image.Config 2018-12-21 15:59:34 -05:00
kubeutils Remove dependency on kubernetes 2018-03-27 21:55:33 +00:00
logs Add CRI logs parsing to podman logs 2018-09-05 13:48:20 +00:00
lookup pkg/lookup: Return ID-only pointers on ErrNo*Entries 2018-12-04 14:46:43 -08:00
namespaces Change all 'can not' to 'cannot' for proper usage 2018-12-21 10:27:54 -05:00
netns Fix godoc comment in pkg/netns 2018-07-27 02:48:16 +00:00
registrar Initial checkin from CRI-O repo 2017-11-01 11:24:59 -04:00
registries Factor out the registries.conf location code in pkg/registries 2018-12-06 23:34:59 +01:00
resolvconf Use host's resolv.conf if no network namespace enabled 2018-11-27 15:28:09 -05:00
rootless rootless: add function to join user and mount namespace 2018-12-21 09:46:05 +01:00
secrets rootless: create empty mounts.conf if it doesn't exist 2018-11-19 12:58:11 +01:00
spec Merge pull request #2082 from rhatdan/runc 2019-01-06 17:27:50 -08:00
sysinfo Update vendor of runc 2019-01-04 14:54:59 -05:00
trust Support podman image trust command 2018-12-19 13:36:11 -05:00
util Merge pull request #2076 from rhatdan/storage.conf 2019-01-08 05:55:40 -08:00
varlinkapi Add ability to build golang remote client 2019-01-07 12:43:57 -06:00