diff options
author | cdoern <cbdoer23@g.holycross.edu> | 2021-06-09 09:20:43 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-06-24 13:42:13 -0400 |
commit | 613f427a03d9a4ea29e32b9c2089d93b0866af29 (patch) | |
tree | f8586b7d13c37a372c6f7453d0fd2aab47725ee4 | |
parent | 949573c5a879e2486fb14984b77660a347b78403 (diff) | |
download | podman-613f427a03d9a4ea29e32b9c2089d93b0866af29.tar.gz podman-613f427a03d9a4ea29e32b9c2089d93b0866af29.tar.bz2 podman-613f427a03d9a4ea29e32b9c2089d93b0866af29.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>
<MH: Fixed cherry-pick conflicts>
Signed-off-by: Matthew Heon <mheon@redhat.com>
-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) |