diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-10-28 14:51:18 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-10-28 16:02:53 -0400 |
commit | 99d3e2e9d72f93399a2d3a5974eea0df6362153f (patch) | |
tree | 3f5f22edc53828c52fc4e58f7305fcca90c293ea /pkg/domain/infra/abi/images.go | |
parent | e04e567b96cafae30863c7782f7bc10c55bfb681 (diff) | |
download | podman-99d3e2e9d72f93399a2d3a5974eea0df6362153f.tar.gz podman-99d3e2e9d72f93399a2d3a5974eea0df6362153f.tar.bz2 podman-99d3e2e9d72f93399a2d3a5974eea0df6362153f.zip |
NewFromLocal can return multiple images
If you use additional stores and pull the same image into
writable stores, you can end up with the situation where
you have the same image twice. This causes image exists
to return the wrong error. It should return true in this
situation rather then an error.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/images.go')
-rw-r--r-- | pkg/domain/infra/abi/images.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 25335cf11..ef0e15264 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -39,8 +39,14 @@ const SignatureStoreDir = "/var/lib/containers/sigstore" func (ir *ImageEngine) Exists(_ context.Context, nameOrID string) (*entities.BoolReport, error) { _, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrID) - if err != nil && errors.Cause(err) != define.ErrNoSuchImage { - return nil, err + if err != nil { + if errors.Cause(err) == define.ErrMultipleImages { + return &entities.BoolReport{Value: true}, nil + } else { + if errors.Cause(err) != define.ErrNoSuchImage { + return nil, err + } + } } return &entities.BoolReport{Value: err == nil}, nil } |