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>
This commit is contained in:
parent
140e08ef64
commit
c34e74755a
|
|
@ -198,6 +198,8 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI
|
||||||
|
|
||||||
if call.WantsMore() {
|
if call.WantsMore() {
|
||||||
call.Continues = true
|
call.Continues = true
|
||||||
|
} else {
|
||||||
|
return call.ReplyErrorOccurred("endpoint requires a more connection")
|
||||||
}
|
}
|
||||||
|
|
||||||
var newPathDockerFiles []string
|
var newPathDockerFiles []string
|
||||||
|
|
@ -642,6 +644,7 @@ func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error {
|
||||||
defer close(c)
|
defer close(c)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
var foundError bool
|
||||||
if strings.HasPrefix(name, dockerarchive.Transport.Name()+":") {
|
if strings.HasPrefix(name, dockerarchive.Transport.Name()+":") {
|
||||||
srcRef, err := alltransports.ParseImageName(name)
|
srcRef, err := alltransports.ParseImageName(name)
|
||||||
if err != nil {
|
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)
|
newImage, err := i.Runtime.ImageRuntime().LoadFromArchiveReference(getContext(), srcRef, "", output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
foundError = true
|
||||||
c <- errors.Wrapf(err, "error pulling image from %q", name)
|
c <- errors.Wrapf(err, "error pulling image from %q", name)
|
||||||
} else {
|
} else {
|
||||||
imageID = newImage[0].ID()
|
imageID = newImage[0].ID()
|
||||||
|
|
@ -656,12 +660,15 @@ func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error {
|
||||||
} else {
|
} else {
|
||||||
newImage, err := i.Runtime.ImageRuntime().New(getContext(), name, "", "", output, &dockerRegistryOptions, so, false, nil)
|
newImage, err := i.Runtime.ImageRuntime().New(getContext(), name, "", "", output, &dockerRegistryOptions, so, false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
foundError = true
|
||||||
c <- errors.Wrapf(err, "unable to pull %s", name)
|
c <- errors.Wrapf(err, "unable to pull %s", name)
|
||||||
} else {
|
} else {
|
||||||
imageID = newImage.ID()
|
imageID = newImage.ID()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c <- nil
|
if !foundError {
|
||||||
|
c <- nil
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var log []string
|
var log []string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue