aboutsummaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/images.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-04-05 09:27:30 -0500
committerbaude <bbaude@redhat.com>2019-04-08 08:37:36 -0500
commit340c6cfb7224a49ee202c60912fbe09e244ba31f (patch)
tree287610b13056f8a2e3cceca1637933b95a3b2b88 /pkg/varlinkapi/images.go
parentd86729e743fb5a58b9364ee5e991b5db2e9dd600 (diff)
downloadpodman-340c6cfb7224a49ee202c60912fbe09e244ba31f.tar.gz
podman-340c6cfb7224a49ee202c60912fbe09e244ba31f.tar.bz2
podman-340c6cfb7224a49ee202c60912fbe09e244ba31f.zip
Correct varlink pull panic
when pulling a non-existent image via varlink, we had a panic because when we detected a pull error we sent the error over a channel but still tried to deduce the image id on a nil object. Fixes: #2860 Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/varlinkapi/images.go')
-rw-r--r--pkg/varlinkapi/images.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index 8cd13e251..2e72ec65b 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -626,7 +626,6 @@ func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string, certDir, c
output := bytes.NewBuffer([]byte{})
c := make(chan error)
go func() {
- //err := newImage.PushImageToHeuristicDestination(getContext(), destname, manifestType, "", signaturePolicy, output, compress, so, &dockerRegistryOptions, nil)
if strings.HasPrefix(name, dockerarchive.Transport.Name()+":") {
srcRef, err := alltransports.ParseImageName(name)
if err != nil {
@@ -635,14 +634,16 @@ func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string, certDir, c
newImage, err := i.Runtime.ImageRuntime().LoadFromArchiveReference(getContext(), srcRef, signaturePolicy, output)
if err != nil {
c <- errors.Wrapf(err, "error pulling image from %q", name)
+ } else {
+ imageID = newImage[0].ID()
}
- imageID = newImage[0].ID()
} else {
newImage, err := i.Runtime.ImageRuntime().New(getContext(), name, signaturePolicy, "", output, &dockerRegistryOptions, so, false, nil)
if err != nil {
c <- errors.Wrapf(err, "unable to pull %s", name)
+ } else {
+ imageID = newImage.ID()
}
- imageID = newImage.ID()
}
c <- nil
close(c)