aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-09 15:11:49 +0100
committerGitHub <noreply@github.com>2021-03-09 15:11:49 +0100
commit09473d43001f5818dbb178cba81f2f61e3de1457 (patch)
tree54d3388e9270ca0571d9c038d3e0f73e43ba6e34
parent66ac9426ecebe43c98684ce4231c36721ff87d3a (diff)
parent930bec4d3a7cfe83784ded58e5f8f88d062dd3e2 (diff)
downloadpodman-09473d43001f5818dbb178cba81f2f61e3de1457.tar.gz
podman-09473d43001f5818dbb178cba81f2f61e3de1457.tar.bz2
podman-09473d43001f5818dbb178cba81f2f61e3de1457.zip
Merge pull request #9677 from vrothberg/fix-9672
podman load: fix error handling
-rw-r--r--libpod/runtime_img.go3
-rw-r--r--test/system/120-load.bats7
2 files changed, 9 insertions, 1 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index abefca788..90b11f8ca 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -316,7 +316,8 @@ func (r *Runtime) LoadImageFromSingleImageArchive(ctx context.Context, writer io
} {
src, err := referenceFn()
if err == nil && src != nil {
- if newImages, err := r.ImageRuntime().LoadFromArchiveReference(ctx, src, signaturePolicy, writer); err == nil {
+ newImages, err := r.ImageRuntime().LoadFromArchiveReference(ctx, src, signaturePolicy, writer)
+ if err == nil {
return getImageNames(newImages), nil
}
saveErr = err
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
index 902cd9f5e..936449bdb 100644
--- a/test/system/120-load.bats
+++ b/test/system/120-load.bats
@@ -26,6 +26,13 @@ verify_iid_and_name() {
is "$new_img_name" "$1" "Name & tag of restored image"
}
+@test "podman load invalid file" {
+ # Regression test for #9672 to make sure invalid input yields errors.
+ invalid=$PODMAN_TMPDIR/invalid
+ echo "I am an invalid file and should cause a podman-load error" > $invalid
+ run_podman 125 load -i $invalid
+}
+
@test "podman save to pipe and load" {
# Generate a random name and tag (must be lower-case)
local random_name=x0$(random_string 12 | tr A-Z a-z)