diff options
author | zhangguanzhang <zhangguanzhang@qq.com> | 2020-08-02 21:08:13 +0800 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-08-11 13:53:23 +0200 |
commit | 8931e99a18cc168ebee07bb72b62849815af7434 (patch) | |
tree | 9ed8bf6344ae3c6e3d629f94b868997c34398bb3 /pkg/network/network.go | |
parent | c24c64e89e8a32b4fa24385aa540ee00f5d0c991 (diff) | |
download | podman-8931e99a18cc168ebee07bb72b62849815af7434.tar.gz podman-8931e99a18cc168ebee07bb72b62849815af7434.tar.bz2 podman-8931e99a18cc168ebee07bb72b62849815af7434.zip |
API returns 500 in case network is not found instead of 404
Backported-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'pkg/network/network.go')
-rw-r--r-- | pkg/network/network.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/network/network.go b/pkg/network/network.go index cbebb0be8..37f3f721a 100644 --- a/pkg/network/network.go +++ b/pkg/network/network.go @@ -8,6 +8,7 @@ import ( "github.com/containernetworking/cni/pkg/types" "github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator" "github.com/containers/common/pkg/config" + "github.com/containers/libpod/v2/libpod/define" "github.com/containers/libpod/v2/pkg/util" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -200,7 +201,7 @@ func InspectNetwork(config *config.Config, name string) (map[string]interface{}, func Exists(config *config.Config, name string) (bool, error) { _, err := ReadRawCNIConfByName(config, name) if err != nil { - if errors.Cause(err) == ErrNetworkNotFound { + if errors.Cause(err) == define.ErrNoSuchNetwork { return false, nil } return false, err |