diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-09-29 10:05:53 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-09-29 15:52:43 -0400 |
commit | 22474095abe39c14c902650b08002c0bc89e7e6a (patch) | |
tree | e601964f926bf5e6b6684d4dae796d7282974f56 /pkg/api/handlers/libpod/networks.go | |
parent | 12f173f4732d50a85bf4875807597d2fd0e92cc0 (diff) | |
download | podman-22474095abe39c14c902650b08002c0bc89e7e6a.tar.gz podman-22474095abe39c14c902650b08002c0bc89e7e6a.tar.bz2 podman-22474095abe39c14c902650b08002c0bc89e7e6a.zip |
Fix handling of remove of bogus volumes, networks and Pods
In podman containers rm and podman images rm, the commands
exit with error code 1 if the object does not exists.
This PR implements similar functionality to volumes, networks, and Pods.
Similarly if volumes or Networks are in use by other containers, and return
exit code 2.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod/networks.go')
-rw-r--r-- | pkg/api/handlers/libpod/networks.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go index dfece2a4e..b3c4840b8 100644 --- a/pkg/api/handlers/libpod/networks.go +++ b/pkg/api/handlers/libpod/networks.go @@ -92,8 +92,8 @@ func RemoveNetwork(w http.ResponseWriter, r *http.Request) { } if reports[0].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) + if errors.Cause(reports[0].Err) == define.ErrNoSuchNetwork { + utils.Error(w, "Something went wrong", http.StatusNotFound, reports[0].Err) return } } |