summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-21 16:05:47 +0200
committerGitHub <noreply@github.com>2020-05-21 16:05:47 +0200
commit6668b131eb02797c24d96cc62e1a78b8202ec04d (patch)
tree22c0495eb3cb27b8da96fd3ea2e7646c68095330 /pkg/api
parenta852afab2f37026fa8a45d115c61cd77fb3e7ef1 (diff)
parent141b34f6bec792e136c82f1e2d56e848f04d0f32 (diff)
downloadpodman-6668b131eb02797c24d96cc62e1a78b8202ec04d.tar.gz
podman-6668b131eb02797c24d96cc62e1a78b8202ec04d.tar.bz2
podman-6668b131eb02797c24d96cc62e1a78b8202ec04d.zip
Merge pull request #6304 from baude/v2remotehctests
Fix remote integration for healthchecks
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/healthcheck.go24
1 files changed, 10 insertions, 14 deletions
diff --git a/pkg/api/handlers/libpod/healthcheck.go b/pkg/api/handlers/libpod/healthcheck.go
index 6eb2ab0e3..0ca3574b7 100644
--- a/pkg/api/handlers/libpod/healthcheck.go
+++ b/pkg/api/handlers/libpod/healthcheck.go
@@ -4,6 +4,7 @@ import (
"net/http"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/api/handlers/utils"
)
@@ -12,32 +13,27 @@ func RunHealthCheck(w http.ResponseWriter, r *http.Request) {
name := utils.GetName(r)
status, err := runtime.HealthCheck(name)
if err != nil {
- if status == libpod.HealthCheckContainerNotFound {
+ if status == define.HealthCheckContainerNotFound {
utils.ContainerNotFound(w, name, err)
return
}
- if status == libpod.HealthCheckNotDefined {
+ if status == define.HealthCheckNotDefined {
utils.Error(w, "no healthcheck defined", http.StatusConflict, err)
return
}
- if status == libpod.HealthCheckContainerStopped {
+ if status == define.HealthCheckContainerStopped {
utils.Error(w, "container not running", http.StatusConflict, err)
return
}
utils.InternalServerError(w, err)
return
}
- ctr, err := runtime.LookupContainer(name)
- if err != nil {
- utils.InternalServerError(w, err)
- return
+ hcStatus := define.HealthCheckUnhealthy
+ if status == define.HealthCheckSuccess {
+ hcStatus = define.HealthCheckHealthy
}
-
- hcLog, err := ctr.GetHealthCheckLog()
- if err != nil {
- utils.InternalServerError(w, err)
- return
+ report := define.HealthCheckResults{
+ Status: hcStatus,
}
-
- utils.WriteResponse(w, http.StatusOK, hcLog)
+ utils.WriteResponse(w, http.StatusOK, report)
}