aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-21 10:32:28 +0100
committerGitHub <noreply@github.com>2020-11-21 10:32:28 +0100
commit5292d5a7b85f9d2ae0b2a3734f8ae4baeba80f11 (patch)
tree6d7e6f6578d6195edd2bc336358b10770f4ca62a /pkg
parentb30ca110ec1deced8dc9322665f3d0ffe8e61bee (diff)
parent435f61f497beb19816c8dc800309081ccef2cda9 (diff)
downloadpodman-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
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/containers.go9
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_")
+ }
+}