aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/healthcheck.go
blob: 699483243486af7c5cea92b2d477bc9fa595f21c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// +build ABISupport

package abi

import (
	"context"

	"github.com/containers/libpod/libpod"
	"github.com/containers/libpod/libpod/define"
	"github.com/containers/libpod/pkg/domain/entities"
)

func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrId string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) {
	status, err := ic.Libpod.HealthCheck(nameOrId)
	if err != nil {
		return nil, err
	}
	hcStatus := "unhealthy"
	if status == libpod.HealthCheckSuccess {
		hcStatus = "healthy"
	}
	report := define.HealthCheckResults{
		Status: hcStatus,
	}
	return &report, nil
}