summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-22 08:18:56 -0700
committerGitHub <noreply@github.com>2021-03-22 08:18:56 -0700
commit9ec936a856a90eeb6a6300cc8bbdc7e7fbdcb9f4 (patch)
tree6100fcd3fe6d486b98b94c8c13e2f22a98014043 /libpod
parentc1f2f75f03853a7cd04dd5e5495700e5fdffcafd (diff)
parent417f36281129434cfa57fcaffb7f10b28b36e2e6 (diff)
downloadpodman-9ec936a856a90eeb6a6300cc8bbdc7e7fbdcb9f4.tar.gz
podman-9ec936a856a90eeb6a6300cc8bbdc7e7fbdcb9f4.tar.bz2
podman-9ec936a856a90eeb6a6300cc8bbdc7e7fbdcb9f4.zip
Merge pull request #9757 from jwhonce/wip/load
Cleanup /libpod/images/load handler
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime_img.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 90b11f8ca..13ac42e7d 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -313,15 +313,23 @@ func (r *Runtime) LoadImageFromSingleImageArchive(ctx context.Context, writer io
func() (types.ImageReference, error) {
return layout.NewReference(inputFile, "")
},
+ func() (types.ImageReference, error) {
+ // This item needs to be last to break out of loop and report meaningful error message
+ return nil,
+ errors.New("payload does not match any of the supported image formats (oci-archive, oci-dir, docker-archive, docker-dir)")
+ },
} {
src, err := referenceFn()
- if err == nil && src != nil {
- newImages, err := r.ImageRuntime().LoadFromArchiveReference(ctx, src, signaturePolicy, writer)
- if err == nil {
- return getImageNames(newImages), nil
- }
+ if err != nil {
saveErr = err
+ continue
+ }
+
+ newImages, err := r.ImageRuntime().LoadFromArchiveReference(ctx, src, signaturePolicy, writer)
+ if err == nil {
+ return getImageNames(newImages), nil
}
+ saveErr = err
}
return "", errors.Wrapf(saveErr, "error pulling image")
}