diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-13 15:00:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-13 15:00:01 +0100 |
commit | 0b1a60ec27928a40ac827148c1517098612616bd (patch) | |
tree | b3902b4614cb521c9873d3200d7f073a135d6308 /pkg | |
parent | 0b3f789a08787c3b2d832a405f6d2d6ff90f5720 (diff) | |
parent | a1187ee6f3a85f8d4e68717731b7b9e2163e8f25 (diff) | |
download | podman-0b1a60ec27928a40ac827148c1517098612616bd.tar.gz podman-0b1a60ec27928a40ac827148c1517098612616bd.tar.bz2 podman-0b1a60ec27928a40ac827148c1517098612616bd.zip |
Merge pull request #8308 from jwhonce/jira/run-976
Refactor to use DockerClient vs APIClient
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/networks.go | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go index 8011c0a04..abbb6d2c0 100644 --- a/pkg/api/handlers/compat/networks.go +++ b/pkg/api/handlers/compat/networks.go @@ -28,17 +28,17 @@ func InspectNetwork(w http.ResponseWriter, r *http.Request) { // FYI scope and version are currently unused but are described by the API // Leaving this for if/when we have to enable these - //query := struct { + // query := struct { // scope string // verbose bool - //}{ + // }{ // // override any golang type defaults - //} - //decoder := r.Context().Value("decoder").(*schema.Decoder) - //if err := decoder.Decode(&query, r.URL.Query()); err != nil { + // } + // decoder := r.Context().Value("decoder").(*schema.Decoder) + // if err := decoder.Decode(&query, r.URL.Query()); err != nil { // utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) // return - //} + // } config, err := runtime.GetConfig() if err != nil { utils.InternalServerError(w, err) @@ -119,7 +119,7 @@ func getNetworkResourceByName(name string, runtime *libpod.Runtime) (*types.Netw } report := types.NetworkResource{ Name: name, - ID: "", + ID: name, Created: time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec)), // nolint: unconvert Scope: "", Driver: network.DefaultNetworkDriver, @@ -207,6 +207,7 @@ func ListNetworks(w http.ResponseWriter, r *http.Request) { } reports := make([]*types.NetworkResource, 0, len(netNames)) + logrus.Errorf("netNames: %q", strings.Join(netNames, ", ")) for _, name := range netNames { report, err := getNetworkResourceByName(name, runtime) if err != nil { @@ -276,21 +277,14 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { utils.InternalServerError(w, err) return } - report := types.NetworkCreate{ - CheckDuplicate: networkCreate.CheckDuplicate, - Driver: networkCreate.Driver, - Scope: networkCreate.Scope, - EnableIPv6: networkCreate.EnableIPv6, - IPAM: networkCreate.IPAM, - Internal: networkCreate.Internal, - Attachable: networkCreate.Attachable, - Ingress: networkCreate.Ingress, - ConfigOnly: networkCreate.ConfigOnly, - ConfigFrom: networkCreate.ConfigFrom, - Options: networkCreate.Options, - Labels: networkCreate.Labels, + + body := struct { + Id string + Warning []string + }{ + Id: name, } - utils.WriteResponse(w, http.StatusOK, report) + utils.WriteResponse(w, http.StatusCreated, body) } func RemoveNetwork(w http.ResponseWriter, r *http.Request) { |