summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-03-22 12:28:52 +0530
committerAditya R <arajan@redhat.com>2022-03-22 12:28:55 +0530
commit6d6bdabc8c3fd10f5770fb79d6d8702bc6cc4ec6 (patch)
tree4c15c264370da55678f89040904884f3b7e424d1 /libpod/container_internal.go
parente034db16bf68c06c1ecf63addd033fcbd83090e3 (diff)
downloadpodman-6d6bdabc8c3fd10f5770fb79d6d8702bc6cc4ec6.tar.gz
podman-6d6bdabc8c3fd10f5770fb79d6d8702bc6cc4ec6.tar.bz2
podman-6d6bdabc8c3fd10f5770fb79d6d8702bc6cc4ec6.zip
healthcheck: stop showing wrong status when --no-healthcheck is set
Containers started with `--no-healthcheck` are configured to contain no healthcheck and test configured as `NONE`. Podman shows wrong status as such use cases. Following commit fixes the faulty behavior of stauts field for containers started with `--no-healthcheck` Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 3c21cade8..f1856cae2 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1268,7 +1268,10 @@ func (c *Container) start() error {
}
}
- if c.config.HealthCheckConfig != nil {
+ // Check if healthcheck is not nil and --no-healthcheck option is not set.
+ // If --no-healthcheck is set Test will be always set to `[NONE]` so no need
+ // to update status in such case.
+ if c.config.HealthCheckConfig != nil && !(len(c.config.HealthCheckConfig.Test) == 1 && c.config.HealthCheckConfig.Test[0] == "NONE") {
if err := c.updateHealthStatus(define.HealthCheckStarting); err != nil {
logrus.Error(err)
}