Commit cc551033 by Kazuhiko Shiozaki

support shacache_ca_file and shadir_ca_file in networkcachehelper.

1 parent 0782ea0e
......@@ -81,16 +81,19 @@ class NetworkcacheClient(object):
self.__new_init(*args, **kw)
def __old_init(self, shacache, shadir, signature_private_key_file=None,
signature_certificate_list=None, shacache_key_file=None,
shacache_cert_file=None, shadir_key_file=None, shadir_cert_file=None):
signature_certificate_list=None, shacache_ca_file=None,
shacache_key_file=None, shacache_cert_file=None,
shadir_ca_file=None, shadir_key_file=None, shadir_cert_file=None):
self.__new_init({
'signature-private-key-file': signature_private_key_file,
'download-cache-url': shacache,
'upload-cache-url': shacache,
'shacache-ca-file': shacache_ca_file,
'shacache-cert-file': shacache_cert_file,
'shacache-key-file': shacache_key_file,
'download-dir-url': shadir,
'upload-dir-url': shadir,
'shadir-ca-file': shadir_ca_file,
'shadir-cert-file': shadir_cert_file,
'shadir-key-file': shadir_key_file,
}, signature_certificate_list)
......
......@@ -21,8 +21,9 @@ from slapos.libnetworkcache import NetworkcacheClient, logger
def __upload_network_cached(dir_url, cache_url,
file_descriptor, directory_key,
signature_private_key_file, shacache_cert_file, shacache_key_file,
shadir_cert_file, shadir_key_file, metadata_dict={}):
signature_private_key_file, shacache_ca_file, shacache_cert_file,
shacache_key_file, shadir_ca_file, shadir_cert_file,
shadir_key_file, metadata_dict={}):
"""
Upload content of a file descriptor to a network cache server using
shacache/shadir API.
......@@ -41,8 +42,10 @@ def __upload_network_cached(dir_url, cache_url,
# convert '' into None in order to call nc nicely
with NetworkcacheClient(cache_url, dir_url,
signature_private_key_file=signature_private_key_file or None,
shacache_ca_file=shacache_ca_file or None,
shacache_cert_file=shacache_cert_file or None,
shacache_key_file=shacache_key_file or None,
shadir_ca_file=shadir_ca_file or None,
shadir_cert_file=shadir_cert_file or None,
shadir_key_file=shadir_key_file or None,
) as nc:
......@@ -53,15 +56,16 @@ helper_upload_network_cached_from_file = None
def helper_upload_network_cached_from_directory(dir_url, cache_url,
path, directory_key, metadata_dict,
signature_private_key_file, shacache_cert_file, shacache_key_file,
shadir_cert_file, shadir_key_file):
signature_private_key_file, shacache_ca_file, shacache_cert_file,
shacache_key_file, shadir_ca_file, shadir_cert_file, shadir_key_file):
"""
Create a tar from a given directory (path) then upload it to networkcache.
"""
return __upload_network_cached(dir_url, cache_url,
NetworkcacheClient.archive(path.rstrip(os.sep)), directory_key,
signature_private_key_file, shacache_cert_file, shacache_key_file,
shadir_cert_file, shadir_key_file, metadata_dict)
signature_private_key_file, shacache_ca_file, shacache_cert_file,
shacache_key_file, shadir_ca_file, shadir_cert_file, shadir_key_file,
metadata_dict)
def helper_download_network_cached(dir_url, cache_url,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!