Skip to content

Commit

Permalink
various fixes for varlink endpoints
Browse files Browse the repository at this point in the history
when using build, require a "more" connection to get logs.

when pulling a non-existent image, do not crash varlink connection.

Fixes: containers#3714
Fixes: containers#3715

Signed-off-by: baude <bbaude@redhat.com>
  • Loading branch information
baude committed Aug 4, 2019
1 parent 140e08e commit c34e747
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/varlinkapi/images.go
Expand Up @@ -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
Expand Down Expand Up @@ -642,26 +644,31 @@ 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 {
c <- errors.Wrapf(err, "error parsing %q", name)
}
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()
}
} 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
Expand Down

0 comments on commit c34e747

Please sign in to comment.