Commit 6bca3a6f authored by Lucas Carvalho's avatar Lucas Carvalho

The slapos.networkcache should not be required, buildout should work without such library.

parent 92ec8137
......@@ -19,8 +19,6 @@ import posixpath
import re
import urllib
import urlparse
from slapos.libnetworkcache import NetworkcacheClient, UploadError, \
DirectoryNotFound
_md5_re = re.compile(r'md5=([a-f0-9]+)')
......@@ -54,6 +52,13 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
return True if download succeeded.
"""
try:
from slapos.libnetworkcache import NetworkcacheClient, UploadError, \
DirectoryNotFound
except:
return False
if sha_cache in (None, '',):
# Not able to use network cache
return False
......@@ -89,6 +94,12 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
def upload_network_cached(sha_cache, sha_dir, external_url, path, logger):
"""Upload file to a shacache server"""
try:
from slapos.libnetworkcache import NetworkcacheClient, UploadError, \
DirectoryNotFound
except:
return False
if sha_cache in [None, ''] or sha_dir in [None, '']:
logger.debug(
'Upload cache ignored, shacache or shadir was not provided!')
......
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