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
import posixpath
import re
import shutil
import urllib2
import urlparse
import traceback
......@@ -106,7 +107,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
logger.warning('Incompatible version of networkcache, not using it.')
return False
logger.info('Downloading %s from network cache.' % url)
logger.debug('Trying to download %s from network cache...' % url)
try:
file_descriptor = nc.select(directory_key)
......@@ -116,14 +117,18 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
finally:
f.close()
file_descriptor.close()
logger.info('Downloaded %s from network cache.' % url)
if not check_md5sum(path, md5sum):
logger.info('MD5 checksum mismatch downloading %s' % url)
return False
except (IOError, DirectoryNotFound), e:
logger.info('Failed to download from network cache %s: %s' % \
(url, str(e)))
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)))
return False
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