diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-20 06:01:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 06:01:20 -0400 |
commit | 49a99be5b6bd50aa0e7b4cf53ec042b0ffd9edf2 (patch) | |
tree | 264fcf52a0a7233e4d824d4171c55be599c3c0fb /pkg | |
parent | cb937f4aa89abc3758bcc761839d3044d194b936 (diff) | |
parent | 898a8ad28514f90e13b05707a0ead148caa33541 (diff) | |
download | podman-49a99be5b6bd50aa0e7b4cf53ec042b0ffd9edf2.tar.gz podman-49a99be5b6bd50aa0e7b4cf53ec042b0ffd9edf2.tar.bz2 podman-49a99be5b6bd50aa0e7b4cf53ec042b0ffd9edf2.zip |
Merge pull request #10377 from vrothberg/test-common
update c/common
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/domain/infra/abi/images.go | 9 | ||||
-rw-r--r-- | pkg/domain/infra/abi/manifest.go | 28 |
2 files changed, 11 insertions, 26 deletions
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 79e815490..083566201 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -313,12 +313,9 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri // list but could not find a matching image instance in the local // containers storage. In that case, fall back and attempt to push the // (entire) manifest. - if errors.Cause(pushError) == storage.ErrImageUnknown { - // Image might be a manifest list so attempt a manifest push - _, manifestErr := ir.ManifestPush(ctx, source, destination, options) - if manifestErr == nil { - return nil - } + if _, err := ir.Libpod.LibimageRuntime().LookupManifestList(source); err == nil { + _, err := ir.ManifestPush(ctx, source, destination, options) + return err } return pushError } diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index 4496b0226..7e5477f4f 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -68,29 +68,17 @@ func (ir *ImageEngine) ManifestInspect(ctx context.Context, name string) ([]byte // inspect foo` wants to do a remote-inspect of foo iff "foo" in the // containers storage is an ordinary image but not a manifest list. - lookupOptions := &libimage.LookupImageOptions{IgnorePlatform: true} - image, _, err := ir.Libpod.LibimageRuntime().LookupImage(name, lookupOptions) + manifestList, err := ir.Libpod.LibimageRuntime().LookupManifestList(name) if err != nil { - // If the image doesn't exist, do a remote inspect. - if errors.Cause(err) == storage.ErrImageUnknown { + switch errors.Cause(err) { + // Do a remote inspect if there's no local image or if the + // local image is not a manifest list. + case storage.ErrImageUnknown, libimage.ErrNotAManifestList: return ir.remoteManifestInspect(ctx, name) - } - return nil, err - } - isManifestList, err := image.IsManifestList(ctx) - if err != nil { - return nil, err - } - - // If the image isn't a manifest list, do a remote inspect. - if !isManifestList { - return ir.remoteManifestInspect(ctx, name) - } - - manifestList, err := image.ToManifestList() - if err != nil { - return nil, err + default: + return nil, err + } } schema2List, err := manifestList.Inspect() |