diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-21 10:32:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-21 10:32:28 +0100 |
commit | 5292d5a7b85f9d2ae0b2a3734f8ae4baeba80f11 (patch) | |
tree | 6d7e6f6578d6195edd2bc336358b10770f4ca62a | |
parent | b30ca110ec1deced8dc9322665f3d0ffe8e61bee (diff) | |
parent | 435f61f497beb19816c8dc800309081ccef2cda9 (diff) | |
download | podman-5292d5a7b85f9d2ae0b2a3734f8ae4baeba80f11.tar.gz podman-5292d5a7b85f9d2ae0b2a3734f8ae4baeba80f11.tar.bz2 podman-5292d5a7b85f9d2ae0b2a3734f8ae4baeba80f11.zip |
Merge pull request #8429 from psakar/fix-json-capabilities
APIv2 - strip CAP_ prefix from capabilities in inspect container json
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 00be8e845..0ee96b855 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -298,6 +298,9 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, state.Running = true } + formatCapabilities(inspect.HostConfig.CapDrop) + formatCapabilities(inspect.HostConfig.CapAdd) + h, err := json.Marshal(inspect.HostConfig) if err != nil { return nil, err @@ -428,3 +431,9 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, } return &c, nil } + +func formatCapabilities(slice []string) { + for i := range slice { + slice[i] = strings.TrimPrefix(slice[i], "CAP_") + } +} |