Commit 9cb0c3d8 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

networkcache: remove not lazy formatting in logger

Leave string interpolation to the logging method
parent d716c541
...@@ -108,7 +108,7 @@ def download_network_cached(cache_url, dir_url, software_url, software_root, ...@@ -108,7 +108,7 @@ def download_network_cached(cache_url, dir_url, software_url, software_root,
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 binary from network cache.' % software_url) logger.info('Downloading %s binary from network cache.', software_url)
try: try:
file_descriptor = None file_descriptor = None
machine_info = machine_info_tuple() machine_info = machine_info_tuple()
...@@ -129,8 +129,8 @@ def download_network_cached(cache_url, dir_url, software_url, software_root, ...@@ -129,8 +129,8 @@ def download_network_cached(cache_url, dir_url, software_url, software_root,
file_descriptor.close() file_descriptor.close()
return True return True
except (IOError, DirectoryNotFound) as e: except (IOError, DirectoryNotFound) as e:
logger.info('Failed to download from network cache %s: %s' % \ logger.info(
(software_url, str(e))) 'Failed to download from network cache %s: %s', software_url, e)
return False return False
...@@ -147,7 +147,7 @@ def upload_network_cached(software_root, software_url, cached_key, ...@@ -147,7 +147,7 @@ def upload_network_cached(software_root, software_url, cached_key,
and cache_url and dir_url): and cache_url and dir_url):
return False return False
logger.info('Uploading %s binary into network cache.' % software_url) logger.info('Uploading %s binary into network cache.', software_url)
# YXU: "file" and "urlmd5" should be removed when server side is ready # YXU: "file" and "urlmd5" should be removed when server side is ready
kw = dict( kw = dict(
...@@ -191,7 +191,7 @@ def upload_network_cached(software_root, software_url, cached_key, ...@@ -191,7 +191,7 @@ def upload_network_cached(software_root, software_url, cached_key,
try: try:
return nc.upload_generic(f, cached_key, **kw) return nc.upload_generic(f, cached_key, **kw)
except (IOError, UploadError) as e: except (IOError, UploadError) as e:
logger.info('Failed to upload file. %s' % str(e)) logger.info('Failed to upload file. %s', e)
return False return False
finally: finally:
f.close() f.close()
......
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