diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-03-09 16:39:01 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-03-10 04:08:29 -0500 |
commit | f1eb8e816257d9dc810cfa6957e09db1ffa7db96 (patch) | |
tree | ed0bbddcfec6d2a58004ccaa2610a3fd673f9b0e /libpod/boltdb_state.go | |
parent | 09473d43001f5818dbb178cba81f2f61e3de1457 (diff) | |
download | podman-f1eb8e816257d9dc810cfa6957e09db1ffa7db96.tar.gz podman-f1eb8e816257d9dc810cfa6957e09db1ffa7db96.tar.bz2 podman-f1eb8e816257d9dc810cfa6957e09db1ffa7db96.zip |
Removing a non existing container API should return 404
Currently we were overwrapping error returned from removal
of a non existing container.
$ podman rm bogus -f
Error: failed to evict container: "": failed to find container "bogus" in state: no container with name or ID bogus found: no such container
Removal of wraps gets us to.
./bin/podman rm bogus -f
Error: no container with name or ID "bogus" found: no such container
Finally also added quotes around container name to help make it standout
when you get an error, currently it gets lost in the error.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/boltdb_state.go')
-rw-r--r-- | libpod/boltdb_state.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go index 122dd080f..5df3e8961 100644 --- a/libpod/boltdb_state.go +++ b/libpod/boltdb_state.go @@ -879,7 +879,7 @@ func (s *BoltState) ContainerInUse(ctr *Container) ([]string, error) { ctrDB := ctrBucket.Bucket([]byte(ctr.ID())) if ctrDB == nil { ctr.valid = false - return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %s found in DB", ctr.ID()) + return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %q found in DB", ctr.ID()) } dependsBkt := ctrDB.Bucket(dependenciesBkt) @@ -1669,7 +1669,7 @@ func (s *BoltState) RewriteContainerConfig(ctr *Container, newCfg *ContainerConf ctrDB := ctrBkt.Bucket([]byte(ctr.ID())) if ctrDB == nil { ctr.valid = false - return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %s found in DB", ctr.ID()) + return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %q found in DB", ctr.ID()) } if err := ctrDB.Put(configKey, newCfgJSON); err != nil { @@ -1767,7 +1767,7 @@ func (s *BoltState) SafeRewriteContainerConfig(ctr *Container, oldName, newName ctrDB := ctrBkt.Bucket([]byte(ctr.ID())) if ctrDB == nil { ctr.valid = false - return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %s found in DB", ctr.ID()) + return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %q found in DB", ctr.ID()) } if err := ctrDB.Put(configKey, newCfgJSON); err != nil { |