mirror of
https://github.com/containers/podman.git
synced 2025-10-17 03:04:21 +08:00
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>
This commit is contained in:
@ -714,7 +714,7 @@ func (r *Runtime) evictContainer(ctx context.Context, idOrName string, removeVol
|
||||
|
||||
id, err := r.state.LookupContainerID(idOrName)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "failed to find container %q in state", idOrName)
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Begin by trying a normal removal. Valid containers will be removed normally.
|
||||
@ -744,7 +744,7 @@ func (r *Runtime) evictContainer(ctx context.Context, idOrName string, removeVol
|
||||
return id, err
|
||||
}
|
||||
if !exists {
|
||||
return id, errors.Wrapf(err, "failed to find container ID %q for eviction", id)
|
||||
return id, err
|
||||
}
|
||||
|
||||
// Re-create a container struct for removal purposes
|
||||
|
Reference in New Issue
Block a user