Commit 519543aa authored by Łukasz Nowak's avatar Łukasz Nowak

Fix naming.

parent a306e450
...@@ -51,7 +51,7 @@ def get_directory_key(url): ...@@ -51,7 +51,7 @@ def get_directory_key(url):
return 'slapos-buildout-%s' % urlmd5 return 'slapos-buildout-%s' % urlmd5
def download_network_cached(download_dir_url, download_cache_url, path, url, logger, md5sum=None): def download_network_cached(dir_url, cache_url, path, url, logger, md5sum=None):
"""Downloads from a network cache provider """Downloads from a network cache provider
If something fail (providor be offline, or hash_string fail), we ignore If something fail (providor be offline, or hash_string fail), we ignore
...@@ -62,7 +62,7 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log ...@@ -62,7 +62,7 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log
if not LIBNETWORKCACHE_ENABLED: if not LIBNETWORKCACHE_ENABLED:
return False return False
if download_cache_url in (None, '',): if cache_url in (None, '',):
# Not able to use network cache # Not able to use network cache
return False return False
if md5sum is None: if md5sum is None:
...@@ -74,7 +74,7 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log ...@@ -74,7 +74,7 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log
logger.info('Downloading %s from network cache.' % file_name) logger.info('Downloading %s from network cache.' % file_name)
try: try:
nc = NetworkcacheClient(shacache=download_cache_url, shadir=download_dir_url) nc = NetworkcacheClient(shacache=cache_url, shadir=dir_url)
file_content = nc.select(directory_key) file_content = nc.select(directory_key)
f = open(path, 'w+b') f = open(path, 'w+b')
...@@ -95,12 +95,12 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log ...@@ -95,12 +95,12 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log
return True return True
def upload_network_cached(download_cache_url, download_dir_url, external_url, path, logger): def upload_network_cached(cache_url, dir_url, external_url, path, logger):
"""Upload file to a network cache server""" """Upload file to a network cache server"""
if not LIBNETWORKCACHE_ENABLED: if not LIBNETWORKCACHE_ENABLED:
return False return False
if download_cache_url in [None, ''] or download_dir_url in [None, '']: if cache_url in [None, ''] or dir_url in [None, '']:
logger.debug( logger.debug(
'Upload cache ignored, shacache or shadir was not provided!') 'Upload cache ignored, shacache or shadir was not provided!')
return False return False
...@@ -112,8 +112,8 @@ def upload_network_cached(download_cache_url, download_dir_url, external_url, pa ...@@ -112,8 +112,8 @@ def upload_network_cached(download_cache_url, download_dir_url, external_url, pa
f = open(path, 'r') f = open(path, 'r')
try: try:
nc = NetworkcacheClient(shacache=download_cache_url, nc = NetworkcacheClient(shacache=cache_url,
shadir=download_dir_url) shadir=dir_url)
data = nc.upload(f, directory_key, **kw) data = nc.upload(f, directory_key, **kw)
except (IOError, UploadError), e: except (IOError, UploadError), e:
logger.info('Fail to upload file. %s' % \ logger.info('Fail to upload file. %s' % \
......
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