From c9ea2cae1e1d48931c0dc3399e1114a66635840f Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 29 Sep 2021 10:03:46 -0400 Subject: Storage can remove ErrNotAContainer as well Fixes: https://github.com/containers/podman/issues/11775 [NO TESTS NEEDED] No easy way to cause this problem in CI. Signed-off-by: Daniel J Walsh --- libpod/runtime_cstorage.go | 2 +- libpod/storage.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libpod/runtime_cstorage.go b/libpod/runtime_cstorage.go index 58bd67e6d..5694967aa 100644 --- a/libpod/runtime_cstorage.go +++ b/libpod/runtime_cstorage.go @@ -121,7 +121,7 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error { } if err := r.store.DeleteContainer(ctr.ID); err != nil { - if errors.Cause(err) == storage.ErrContainerUnknown { + if errors.Cause(err) == storage.ErrNotAContainer || errors.Cause(err) == storage.ErrContainerUnknown { // Container again gone, no error logrus.Infof("Storage for container %s already removed", ctr.ID) return nil diff --git a/libpod/storage.go b/libpod/storage.go index ad78fe191..5c265df40 100644 --- a/libpod/storage.go +++ b/libpod/storage.go @@ -184,8 +184,12 @@ func (r *storageService) DeleteContainer(idOrName string) error { } err = r.store.DeleteContainer(container.ID) if err != nil { - logrus.Debugf("Failed to delete container %q: %v", container.ID, err) - return err + if errors.Cause(err) == storage.ErrNotAContainer || errors.Cause(err) == storage.ErrContainerUnknown { + logrus.Infof("Storage for container %s already removed", container.ID) + } else { + logrus.Debugf("Failed to delete container %q: %v", container.ID, err) + return err + } } return nil } -- cgit v1.2.3-54-g00ecf