diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2021-04-14 13:35:43 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-04-21 14:17:53 -0400 |
commit | e1ea4835fc5cb92aeb41e995652fcca406661214 (patch) | |
tree | c82fd1bad933558fd14423973d7a83c5c8becc0e /libpod | |
parent | 4973e4704f5d1f99f18db6df00daec8e39b71b7d (diff) | |
download | podman-e1ea4835fc5cb92aeb41e995652fcca406661214.tar.gz podman-e1ea4835fc5cb92aeb41e995652fcca406661214.tar.bz2 podman-e1ea4835fc5cb92aeb41e995652fcca406661214.zip |
rmi: don't break when the image is missing a manifest
In libpod/image.Image.Remove(), if the attempt to find the image's
parent fails for any reason, log a warning and proceed as though it
didn't have one instead of failing, which would leave us unable to
remove the image without resetting everything.
In libpod/Runtime.RemoveImage(), if we can't determine if an image has
children, log a warning, and assume that it doesn't have any instead of
failing, which would leave us unable to remove the image without
resetting everything.
In pkg/domain/infra/abi.ImageEngine.Remove(), when attempting to remove
all images, if we encounter an error checking if a given image has
children, log a warning, and assume that it doesn't have any instead of
failing, which would leave us unable to remove the image without
resetting everything.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/image/image.go | 3 | ||||
-rw-r--r-- | libpod/runtime_img.go | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go index 12dc22360..3c9fb3a37 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -617,7 +617,8 @@ func (i *Image) TopLayer() string { func (i *Image) Remove(ctx context.Context, force bool) error { parent, err := i.GetParent(ctx) if err != nil { - return err + logrus.Warnf("error determining parent of image: %v, ignoring the error", err) + parent = nil } if _, err := i.imageruntime.store.DeleteImage(i.ID(), true); err != nil { return err diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go index 3588467a5..2b101c01f 100644 --- a/libpod/runtime_img.go +++ b/libpod/runtime_img.go @@ -66,7 +66,8 @@ func (r *Runtime) RemoveImage(ctx context.Context, img *image.Image, force bool) hasChildren, err := img.IsParent(ctx) if err != nil { - return nil, err + logrus.Warnf("error determining if an image is a parent: %v, ignoring the error", err) + hasChildren = false } if (len(img.Names()) > 1 && !img.InputIsID()) || hasChildren { |