diff options
author | cdoern <cbdoer23@g.holycross.edu> | 2021-06-09 09:20:43 -0400 |
---|---|---|
committer | cdoern <cbdoer23@g.holycross.edu> | 2021-06-23 13:16:19 -0400 |
commit | 6ecdf4c389fd8e079fbfae76c11351c0301eb003 (patch) | |
tree | 77d2c9183318fb40274a58ef5dba698ec22567f7 /pkg/api | |
parent | c75d62c9877f56f6cc6253087b75ab05b8e4eac5 (diff) | |
download | podman-6ecdf4c389fd8e079fbfae76c11351c0301eb003.tar.gz podman-6ecdf4c389fd8e079fbfae76c11351c0301eb003.tar.bz2 podman-6ecdf4c389fd8e079fbfae76c11351c0301eb003.zip |
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>
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 6bc02dd2b..2a0a0b725 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -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) |