diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-06-23 14:45:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 14:45:29 -0400 |
commit | b0a3ac35785fca1a054d236937c86cce85631585 (patch) | |
tree | c9b5b8a72cb57ddbfb49a463564468c24f23b637 /pkg/api/handlers | |
parent | 2b850ef055885bf3482f405e804fb02aef2e9895 (diff) | |
parent | 6ecdf4c389fd8e079fbfae76c11351c0301eb003 (diff) | |
download | podman-b0a3ac35785fca1a054d236937c86cce85631585.tar.gz podman-b0a3ac35785fca1a054d236937c86cce85631585.tar.bz2 podman-b0a3ac35785fca1a054d236937c86cce85631585.zip |
Merge pull request #10610 from cdoern/healthCheck
Edited compat handling code for containers/json status and added python tests
Diffstat (limited to 'pkg/api/handlers')
-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) |