summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-05-04 11:25:12 +0200
committerPaul Holzinger <paul.holzinger@web.de>2021-05-04 11:25:12 +0200
commitf185666da8cc3af053f4d794d249f2fedc6e67e4 (patch)
tree1e049912bf5dfa7762a24128f209a4073446c2e9 /pkg/api/handlers
parent9788289f942ff7a79c214446047d0f943c66f409 (diff)
downloadpodman-f185666da8cc3af053f4d794d249f2fedc6e67e4.tar.gz
podman-f185666da8cc3af053f4d794d249f2fedc6e67e4.tar.bz2
podman-f185666da8cc3af053f4d794d249f2fedc6e67e4.zip
compat api: Networks must be empty instead of null
The compat endpoint for container inspect must return {} instead of null for NetworkSettings.Networks. Fixes #9837 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/compat/containers.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index d97a4d3bd..263d64a7b 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -22,6 +22,7 @@ import (
"github.com/containers/podman/v3/pkg/util"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
+ "github.com/docker/docker/api/types/network"
"github.com/docker/go-connections/nat"
"github.com/docker/go-units"
"github.com/gorilla/schema"
@@ -526,6 +527,10 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
if err := json.Unmarshal(n, &networkSettings); err != nil {
return nil, err
}
+ // do not report null instead use an empty map
+ if networkSettings.Networks == nil {
+ networkSettings.Networks = map[string]*network.EndpointSettings{}
+ }
c := types.ContainerJSON{
ContainerJSONBase: &cb,