mirror of
https://github.com/containers/podman.git
synced 2025-06-20 17:13:43 +08:00
Merge pull request #3093 from baude/healthcheckfixes
healthcheck benign error
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/coreos/go-systemd/dbus"
|
"github.com/coreos/go-systemd/dbus"
|
||||||
"github.com/pkg/errors"
|
"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")
|
return errors.Wrapf(err, "unable to get systemd connection to remove healthchecks")
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
serviceFile := fmt.Sprintf("%s.timer", c.ID())
|
timerFile := fmt.Sprintf("%s.timer", c.ID())
|
||||||
_, err = conn.StopUnit(serviceFile, "fail", nil)
|
_, 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
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user