summaryrefslogtreecommitdiff
path: root/libpod/runtime_img.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/runtime_img.go')
-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")
}