Skip to content

Commit

Permalink
Merge pull request containers#9480 from jmguzik/replace-nil-with-brac…
Browse files Browse the repository at this point in the history
…es-network-resource

[NO TESTS NEEDED] Replace Labels and Options nulls with {} in NetworkResource
  • Loading branch information
openshift-merge-robot authored Feb 23, 2021
2 parents 5ff5c48 + fcf669f commit 96fc9d9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/api/handlers/compat/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ func getNetworkResourceByNameOrID(nameOrID string, runtime *libpod.Runtime, filt
containerEndpoints[con.ID()] = containerEndpoint
}
}

labels := network.GetNetworkLabels(conf)
if labels == nil {
labels = map[string]string{}
}

report := types.NetworkResource{
Name: conf.Name,
ID: network.GetNetworkID(conf.Name),
Expand All @@ -136,7 +142,7 @@ func getNetworkResourceByNameOrID(nameOrID string, runtime *libpod.Runtime, filt
EnableIPv6: false,
IPAM: dockerNetwork.IPAM{
Driver: "default",
Options: nil,
Options: map[string]string{},
Config: ipamConfigs,
},
Internal: !bridge.IsGW,
Expand All @@ -145,8 +151,8 @@ func getNetworkResourceByNameOrID(nameOrID string, runtime *libpod.Runtime, filt
ConfigFrom: dockerNetwork.ConfigReference{},
ConfigOnly: false,
Containers: containerEndpoints,
Options: nil,
Labels: network.GetNetworkLabels(conf),
Options: map[string]string{},
Labels: labels,
Peers: nil,
Services: nil,
}
Expand Down

0 comments on commit 96fc9d9

Please sign in to comment.