diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-03 16:44:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-03 16:44:15 +0100 |
commit | e7222e34da87eb0ec3185bb64f3335ab613fd69a (patch) | |
tree | 393dfe6f98b7ef2e596841bb343e8be76a707502 /libpod | |
parent | 99a5754d6dbfa2479d092d2ee0770a6bcfb47b13 (diff) | |
parent | 7117d5605a801cb5bf3893063f37b6b5a1e1158a (diff) | |
download | podman-e7222e34da87eb0ec3185bb64f3335ab613fd69a.tar.gz podman-e7222e34da87eb0ec3185bb64f3335ab613fd69a.tar.bz2 podman-e7222e34da87eb0ec3185bb64f3335ab613fd69a.zip |
Merge pull request #12697 from baude/servicefailedstates
.service file removal on failure
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/healthcheck_linux.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/healthcheck_linux.go b/libpod/healthcheck_linux.go index 2c19e0a61..a1f3e8491 100644 --- a/libpod/healthcheck_linux.go +++ b/libpod/healthcheck_linux.go @@ -73,6 +73,16 @@ func (c *Container) removeTransientFiles(ctx context.Context) error { defer conn.Close() timerFile := fmt.Sprintf("%s.timer", c.ID()) serviceFile := fmt.Sprintf("%s.service", c.ID()) + + // If the service has failed (the healthcheck has failed), then + // the .service file is not removed on stopping the unit file. If + // we check the properties of the service, it will automatically + // reset the state. But checking the state takes msecs vs usecs to + // blindly call reset. + if err := conn.ResetFailedUnitContext(ctx, serviceFile); err != nil { + logrus.Debugf("failed to reset unit file: %q", err) + } + // We want to ignore errors where the timer unit and/or service unit has already // been removed. The error return is generic so we have to check against the // string in the error |