diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-16 17:17:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-16 17:17:08 -0400 |
commit | 6cf13c3dbf05a263c08c3f1b1a10cfed722e5929 (patch) | |
tree | 3f235e0cfcf8ffb9082855eb03d1828f71940047 /pkg/api/handlers | |
parent | 0acf540304b7d2f57357522e4fb47914b0b31a70 (diff) | |
parent | 5c7935057c34cbdb27be3a584d35bff3fcd81202 (diff) | |
download | podman-6cf13c3dbf05a263c08c3f1b1a10cfed722e5929.tar.gz podman-6cf13c3dbf05a263c08c3f1b1a10cfed722e5929.tar.bz2 podman-6cf13c3dbf05a263c08c3f1b1a10cfed722e5929.zip |
Merge pull request #11602 from Luap99/netname
Do not allow network modes to be used as network names
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/compat/networks.go | 5 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/networks.go | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go index 28727a22b..b1456ed9e 100644 --- a/pkg/api/handlers/compat/networks.go +++ b/pkg/api/handlers/compat/networks.go @@ -224,7 +224,8 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { // FIXME can we use the IPAM driver and options? } - network, err := runtime.Network().NetworkCreate(network) + ic := abi.ContainerEngine{Libpod: runtime} + newNetwork, err := ic.NetworkCreate(r.Context(), network) if err != nil { utils.InternalServerError(w, err) return @@ -234,7 +235,7 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { ID string `json:"Id"` Warning []string }{ - ID: network.ID, + ID: newNetwork.ID, } utils.WriteResponse(w, http.StatusCreated, body) } diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go index fcd8e0231..1f7f2e26c 100644 --- a/pkg/api/handlers/libpod/networks.go +++ b/pkg/api/handlers/libpod/networks.go @@ -25,7 +25,7 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { } ic := abi.ContainerEngine{Libpod: runtime} - report, err := ic.Libpod.Network().NetworkCreate(network) + report, err := ic.NetworkCreate(r.Context(), network) if err != nil { utils.InternalServerError(w, err) return |