mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Health Check is not handled in the compat LibpodToContainerJSON
Added parsing and handling for the healthCheck status within containers.go. Also modified tests fixes #10457 Signed-off-by: cdoern <cbdoer23@g.holycross.edu> <MH: Fixed cherry-pick conflicts> Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
@ -403,6 +403,24 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
|
||||
state.Status = define.ContainerStateCreated.String()
|
||||
}
|
||||
|
||||
state.Health = &types.Health{
|
||||
Status: inspect.State.Healthcheck.Status,
|
||||
FailingStreak: inspect.State.Healthcheck.FailingStreak,
|
||||
}
|
||||
|
||||
log := inspect.State.Healthcheck.Log
|
||||
|
||||
for _, item := range log {
|
||||
res := &types.HealthcheckResult{}
|
||||
s, _ := time.Parse(time.RFC3339Nano, item.Start)
|
||||
e, _ := time.Parse(time.RFC3339Nano, item.End)
|
||||
res.Start = s
|
||||
res.End = e
|
||||
res.ExitCode = item.ExitCode
|
||||
res.Output = item.Output
|
||||
state.Health.Log = append(state.Health.Log, res)
|
||||
}
|
||||
|
||||
formatCapabilities(inspect.HostConfig.CapDrop)
|
||||
formatCapabilities(inspect.HostConfig.CapAdd)
|
||||
|
||||
|
Reference in New Issue
Block a user