aboutsummaryrefslogtreecommitdiff
path: root/libpod/healthcheck_linux.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-09-29 18:26:15 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-09-29 18:26:15 +0200
commitb07eb0bc91b6de7c0f3e52cea5611a8b9115d6ca (patch)
tree04e474797761aabb480fb6021a13b1ed589fb013 /libpod/healthcheck_linux.go
parent5cf865926ed62c8baa691f96e8fe5f585e077083 (diff)
downloadpodman-b07eb0bc91b6de7c0f3e52cea5611a8b9115d6ca.tar.gz
podman-b07eb0bc91b6de7c0f3e52cea5611a8b9115d6ca.tar.bz2
podman-b07eb0bc91b6de7c0f3e52cea5611a8b9115d6ca.zip
healthchecks: return systemd-run error
In case `systemd-run` errors when creating transient unit files (and timers), create an error based on the combined output from stdout and stderr. Using the error from `exec.Command` contains the exit code only which is not useful to debug (see #7484). Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/healthcheck_linux.go')
-rw-r--r--libpod/healthcheck_linux.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/libpod/healthcheck_linux.go b/libpod/healthcheck_linux.go
index 08f37d412..b0f1ff35d 100644
--- a/libpod/healthcheck_linux.go
+++ b/libpod/healthcheck_linux.go
@@ -35,9 +35,8 @@ func (c *Container) createTimer() error {
conn.Close()
logrus.Debugf("creating systemd-transient files: %s %s", "systemd-run", cmd)
systemdRun := exec.Command("systemd-run", cmd...)
- _, err = systemdRun.CombinedOutput()
- if err != nil {
- return err
+ if output, err := systemdRun.CombinedOutput(); err != nil {
+ return errors.Errorf("%s", output)
}
return nil
}