diff options
author | Aditya R <arajan@redhat.com> | 2022-03-22 12:28:52 +0530 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-03-30 15:36:05 -0400 |
commit | ef202133f512dfd40bf83ee1306039736ff74fcd (patch) | |
tree | 2052b897e69d7e850ea0ed26bd898b496e371c42 /libpod/container_internal.go | |
parent | 116a9ef02fd8470bb7e7428cd07a51d4fed2a1c9 (diff) | |
download | podman-ef202133f512dfd40bf83ee1306039736ff74fcd.tar.gz podman-ef202133f512dfd40bf83ee1306039736ff74fcd.tar.bz2 podman-ef202133f512dfd40bf83ee1306039736ff74fcd.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.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 908b69f68..0618cc02e 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1261,7 +1261,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) } |