diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-08-19 20:17:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-19 20:17:31 +0200 |
commit | d23639aa4d24278648a2ba5532143d47464a3d7d (patch) | |
tree | 52564628f753235de5e3ba416ae6340e004936ac /pkg/varlinkapi | |
parent | c137e8fcf95b441b5002ec1b39e6cc131471b88a (diff) | |
parent | 8c7014f11d02c324b56779ef277e0c9365ce1c86 (diff) | |
download | podman-d23639aa4d24278648a2ba5532143d47464a3d7d.tar.gz podman-d23639aa4d24278648a2ba5532143d47464a3d7d.tar.bz2 podman-d23639aa4d24278648a2ba5532143d47464a3d7d.zip |
Merge pull request #3476 from ashley-cui/remotehealthcheck
Implement healthcheck for remote client
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r-- | pkg/varlinkapi/containers.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go index c7aa5233f..2dcdbc089 100644 --- a/pkg/varlinkapi/containers.go +++ b/pkg/varlinkapi/containers.go @@ -14,7 +14,7 @@ import ( "time" "github.com/containers/libpod/cmd/podman/shared" - "github.com/containers/libpod/cmd/podman/varlink" + iopodman "github.com/containers/libpod/cmd/podman/varlink" "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/libpod/logs" @@ -864,3 +864,16 @@ func (i *LibpodAPI) ExecContainer(call iopodman.VarlinkCall, opts iopodman.ExecO return ecErr.Error } + +//HealthCheckRun executes defined container's healthcheck command and returns the container's health status. +func (i *LibpodAPI) HealthCheckRun(call iopodman.VarlinkCall, nameOrID string) error { + hcStatus, err := i.Runtime.HealthCheck(nameOrID) + if err != nil && hcStatus != libpod.HealthCheckFailure { + return call.ReplyErrorOccurred(err.Error()) + } + status := libpod.HealthCheckUnhealthy + if hcStatus == libpod.HealthCheckSuccess { + status = libpod.HealthCheckHealthy + } + return call.ReplyHealthCheckRun(status) +} |