[Pkg-libvirt-commits] [libvirt-sandbox] 24/42: docker: fix download progress target value

Guido Guenther agx at moszumanska.debian.org
Sat May 27 16:27:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

agx pushed a commit to branch debian/experimental
in repository libvirt-sandbox.

commit 9621e899cbe6d145bbc4e103ee874f6b9bad94fb
Author: Daniel P. Berrange <berrange at redhat.com>
Date:   Thu Jul 14 11:57:31 2016 +0100

    docker: fix download progress target value
    
    The download code was mistakenly using the length of the json
    manifest in place of the length of the image file blob.
    
    Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 libvirt-sandbox/image/sources/docker.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libvirt-sandbox/image/sources/docker.py b/libvirt-sandbox/image/sources/docker.py
index 3e0aa9f..3b59051 100644
--- a/libvirt-sandbox/image/sources/docker.py
+++ b/libvirt-sandbox/image/sources/docker.py
@@ -138,8 +138,6 @@ class DockerSource(base.Source):
                                           jsonfile)
                     createdFiles.append(jsonfile)
 
-                    layersize = int(res.info().getheader("Content-Length"))
-
                     datacsum = None
                     if layerid in checksums:
                         datacsum = checksums[layerid]
@@ -148,7 +146,7 @@ class DockerSource(base.Source):
                                     registryendpoint,
                                     "/v1/images/" + layerid + "/layer",
                                     headers,
-                                    datafile, datacsum, layersize)
+                                    datafile, datacsum)
                     createdFiles.append(datafile)
 
             index = {
@@ -173,10 +171,14 @@ class DockerSource(base.Source):
                     pass
 
     def _save_data(self, template, server, path, headers,
-                   dest, checksum=None, datalen=None):
+                   dest, checksum=None):
         try:
             res = self._get_url(template, server, path, headers)
 
+            datalen = res.info().getheader("Content-Length")
+            if datalen is not None:
+                datalen = int(datalen)
+
             csum = None
             if checksum is not None:
                 csum = hashlib.sha256()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libvirt-sandbox.git



More information about the Pkg-libvirt-commits mailing list