diff options
author | baude <bbaude@redhat.com> | 2019-08-03 19:05:22 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-08-03 19:05:22 -0500 |
commit | c34e74755abad1daa76ca9318e6c7a4ff0937a4d (patch) | |
tree | be3416306c0be543351a032e044b7ad7f6a13e6e /pkg | |
parent | 140e08ef64591ecbce11ba8fff94afa8e5e65eeb (diff) | |
download | podman-c34e74755abad1daa76ca9318e6c7a4ff0937a4d.tar.gz podman-c34e74755abad1daa76ca9318e6c7a4ff0937a4d.tar.bz2 podman-c34e74755abad1daa76ca9318e6c7a4ff0937a4d.zip |
various fixes for varlink endpoints
when using build, require a "more" connection to get logs.
when pulling a non-existent image, do not crash varlink connection.
Fixes: #3714
Fixes: #3715
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/varlinkapi/images.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go index 338499bd4..b5a711dfd 100644 --- a/pkg/varlinkapi/images.go +++ b/pkg/varlinkapi/images.go @@ -198,6 +198,8 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI if call.WantsMore() { call.Continues = true + } else { + return call.ReplyErrorOccurred("endpoint requires a more connection") } var newPathDockerFiles []string @@ -642,6 +644,7 @@ func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error { defer close(c) go func() { + var foundError bool if strings.HasPrefix(name, dockerarchive.Transport.Name()+":") { srcRef, err := alltransports.ParseImageName(name) if err != nil { @@ -649,6 +652,7 @@ func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error { } newImage, err := i.Runtime.ImageRuntime().LoadFromArchiveReference(getContext(), srcRef, "", output) if err != nil { + foundError = true c <- errors.Wrapf(err, "error pulling image from %q", name) } else { imageID = newImage[0].ID() @@ -656,12 +660,15 @@ func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error { } else { newImage, err := i.Runtime.ImageRuntime().New(getContext(), name, "", "", output, &dockerRegistryOptions, so, false, nil) if err != nil { + foundError = true c <- errors.Wrapf(err, "unable to pull %s", name) } else { imageID = newImage.ID() } } - c <- nil + if !foundError { + c <- nil + } }() var log []string |