summaryrefslogtreecommitdiff
path: root/libpod/healthcheck.go
diff options
context:
space:
mode:
authorJake Correnti <jcorrenti13@gmail.com>2022-06-16 15:57:01 -0400
committerJake Correnti <jcorrenti13@gmail.com>2022-07-05 08:02:22 -0400
commit5633ef1d15c17fa2e0249710c7591da777cd7b5e (patch)
tree35439157caae1692340b4fa1f2de8d6f876bcbc6 /libpod/healthcheck.go
parentd1e1400747fd3266bfc14d62b4174cd601107003 (diff)
downloadpodman-5633ef1d15c17fa2e0249710c7591da777cd7b5e.tar.gz
podman-5633ef1d15c17fa2e0249710c7591da777cd7b5e.tar.bz2
podman-5633ef1d15c17fa2e0249710c7591da777cd7b5e.zip
Docker-compose disable healthcheck properly handled
Previously, if a container had healthchecks disabled in the docker-compose.yml file and the user did a `podman inspect <container>`, they would have an incorrect output: ``` "Healthcheck":{ "Test":[ "CMD-SHELL", "NONE" ], "Interval":30000000000, "Timeout":30000000000, "Retries":3 } ``` After a quick change, the correct output is now the result: ``` "Healthcheck":{ "Test":[ "NONE" ] } ``` Additionally, I extracted the hard-coded strings that were used for comparisons into constants in `libpod/define` to prevent a similar issue from recurring. Closes: #14493 Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
Diffstat (limited to 'libpod/healthcheck.go')
-rw-r--r--libpod/healthcheck.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/libpod/healthcheck.go b/libpod/healthcheck.go
index 95c70b60e..df6f00e7e 100644
--- a/libpod/healthcheck.go
+++ b/libpod/healthcheck.go
@@ -47,11 +47,11 @@ func (c *Container) runHealthCheck() (define.HealthCheckStatus, error) {
return define.HealthCheckNotDefined, errors.Errorf("container %s has no defined healthcheck", c.ID())
}
switch hcCommand[0] {
- case "", "NONE":
+ case "", define.HealthConfigTestNone:
return define.HealthCheckNotDefined, errors.Errorf("container %s has no defined healthcheck", c.ID())
- case "CMD":
+ case define.HealthConfigTestCmd:
newCommand = hcCommand[1:]
- case "CMD-SHELL":
+ case define.HealthConfigTestCmdShell:
// TODO: SHELL command from image not available in Container - use Docker default
newCommand = []string{"/bin/sh", "-c", strings.Join(hcCommand[1:], " ")}
default: