summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/networks.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-27 17:04:44 -0400
committerGitHub <noreply@github.com>2020-10-27 17:04:44 -0400
commit7149a7cb396dd5951f9c632e79ba3c96a7797c5f (patch)
treeb3dcd6379cd01e4d9b4bd64d89fe75a092c7ec43 /pkg/api/handlers/libpod/networks.go
parent26c09291a3ea2b0e05d033a1ecf0441403d0d31a (diff)
parent61deec451f279cdc09b4415fe4988c2f8548e55a (diff)
downloadpodman-7149a7cb396dd5951f9c632e79ba3c96a7797c5f.tar.gz
podman-7149a7cb396dd5951f9c632e79ba3c96a7797c5f.tar.bz2
podman-7149a7cb396dd5951f9c632e79ba3c96a7797c5f.zip
Merge pull request #8102 from ashley-cui/inspect
Add pod, volume, network to inspect package
Diffstat (limited to 'pkg/api/handlers/libpod/networks.go')
-rw-r--r--pkg/api/handlers/libpod/networks.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go
index b7e2b3988..9f6103c45 100644
--- a/pkg/api/handlers/libpod/networks.go
+++ b/pkg/api/handlers/libpod/networks.go
@@ -113,15 +113,15 @@ func InspectNetwork(w http.ResponseWriter, r *http.Request) {
return
}
name := utils.GetName(r)
- options := entities.NetworkInspectOptions{}
+ options := entities.InspectOptions{}
ic := abi.ContainerEngine{Libpod: runtime}
- reports, err := ic.NetworkInspect(r.Context(), []string{name}, options)
+ reports, errs, err := ic.NetworkInspect(r.Context(), []string{name}, options)
+ // If the network cannot be found, we return a 404.
+ if len(errs) > 0 {
+ utils.Error(w, "Something went wrong", http.StatusNotFound, define.ErrNoSuchNetwork)
+ return
+ }
if err != nil {
- // If the network cannot be found, we return a 404.
- if errors.Cause(err) == define.ErrNoSuchNetwork {
- utils.Error(w, "Something went wrong", http.StatusNotFound, err)
- return
- }
utils.InternalServerError(w, err)
return
}