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(a)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()
--
2.7.4