summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-05-09 10:49:59 -0500
committerbaude <bbaude@redhat.com>2019-05-13 08:33:51 -0500
commitc71761b9ba9310d2be4453c9dcd14c2ccaacfd6e (patch)
treed6e54dfc02236fab8a5e3af2df00fc61c39e502d /libpod
parentd2571c7fd49d22e822a6f3b3796488218c9f9e46 (diff)
downloadpodman-c71761b9ba9310d2be4453c9dcd14c2ccaacfd6e.tar.gz
podman-c71761b9ba9310d2be4453c9dcd14c2ccaacfd6e.tar.bz2
podman-c71761b9ba9310d2be4453c9dcd14c2ccaacfd6e.zip
healthcheck benign error
clean up the reporting of a benign error that can occur when a container is first stopped and then removed. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/healthcheck_linux.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/libpod/healthcheck_linux.go b/libpod/healthcheck_linux.go
index 869605ea8..d47a3b7cd 100644
--- a/libpod/healthcheck_linux.go
+++ b/libpod/healthcheck_linux.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"os/exec"
+ "strings"
"github.com/coreos/go-systemd/dbus"
"github.com/pkg/errors"
@@ -61,7 +62,13 @@ func (c *Container) removeTimer() error {
return errors.Wrapf(err, "unable to get systemd connection to remove healthchecks")
}
defer conn.Close()
- serviceFile := fmt.Sprintf("%s.timer", c.ID())
- _, err = conn.StopUnit(serviceFile, "fail", nil)
+ timerFile := fmt.Sprintf("%s.timer", c.ID())
+ _, err = conn.StopUnit(timerFile, "fail", nil)
+
+ // We want to ignore errors where the timer unit has already been removed. The error
+ // return is generic so we have to check against the string in the error
+ if err != nil && strings.HasSuffix(err.Error(), ".timer not loaded.") {
+ return nil
+ }
return err
}