Commit 16bc0515 authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge branch 'bug_778748'

parents 8ce62d5e c9545718
...@@ -18,6 +18,7 @@ import os ...@@ -18,6 +18,7 @@ import os
import posixpath import posixpath
import re import re
import shutil import shutil
import urllib2
import urlparse import urlparse
import traceback import traceback
...@@ -106,7 +107,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger, ...@@ -106,7 +107,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
logger.warning('Incompatible version of networkcache, not using it.') logger.warning('Incompatible version of networkcache, not using it.')
return False return False
logger.info('Downloading %s from network cache.' % url) logger.debug('Trying to download %s from network cache...' % url)
try: try:
file_descriptor = nc.select(directory_key) file_descriptor = nc.select(directory_key)
...@@ -116,13 +117,17 @@ def download_network_cached(dir_url, cache_url, path, url, logger, ...@@ -116,13 +117,17 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
finally: finally:
f.close() f.close()
file_descriptor.close() file_descriptor.close()
logger.info('Downloaded %s from network cache.' % url)
if not check_md5sum(path, md5sum): if not check_md5sum(path, md5sum):
logger.info('MD5 checksum mismatch downloading %s' % url) logger.info('MD5 checksum mismatch downloading %s' % url)
return False return False
except (IOError, DirectoryNotFound), e: except (IOError, DirectoryNotFound), e:
logger.info('Failed to download from network cache %s: %s' % \ if isinstance(e, urllib2.HTTPError) and e.code == 404:
logger.debug('%s does not exist in network cache.' % url)
else:
logger.debug('Failed to download from network cache %s: %s' % \
(url, str(e))) (url, str(e)))
return False return False
return True return True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment