Commit cc551033 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support shacache_ca_file and shadir_ca_file in networkcachehelper.

parent 0782ea0e
...@@ -81,16 +81,19 @@ class NetworkcacheClient(object): ...@@ -81,16 +81,19 @@ class NetworkcacheClient(object):
self.__new_init(*args, **kw) self.__new_init(*args, **kw)
def __old_init(self, shacache, shadir, signature_private_key_file=None, def __old_init(self, shacache, shadir, signature_private_key_file=None,
signature_certificate_list=None, shacache_key_file=None, signature_certificate_list=None, shacache_ca_file=None,
shacache_cert_file=None, shadir_key_file=None, shadir_cert_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({ self.__new_init({
'signature-private-key-file': signature_private_key_file, 'signature-private-key-file': signature_private_key_file,
'download-cache-url': shacache, 'download-cache-url': shacache,
'upload-cache-url': shacache, 'upload-cache-url': shacache,
'shacache-ca-file': shacache_ca_file,
'shacache-cert-file': shacache_cert_file, 'shacache-cert-file': shacache_cert_file,
'shacache-key-file': shacache_key_file, 'shacache-key-file': shacache_key_file,
'download-dir-url': shadir, 'download-dir-url': shadir,
'upload-dir-url': shadir, 'upload-dir-url': shadir,
'shadir-ca-file': shadir_ca_file,
'shadir-cert-file': shadir_cert_file, 'shadir-cert-file': shadir_cert_file,
'shadir-key-file': shadir_key_file, 'shadir-key-file': shadir_key_file,
}, signature_certificate_list) }, signature_certificate_list)
......
...@@ -21,8 +21,9 @@ from slapos.libnetworkcache import NetworkcacheClient, logger ...@@ -21,8 +21,9 @@ from slapos.libnetworkcache import NetworkcacheClient, logger
def __upload_network_cached(dir_url, cache_url, def __upload_network_cached(dir_url, cache_url,
file_descriptor, directory_key, file_descriptor, directory_key,
signature_private_key_file, shacache_cert_file, shacache_key_file, signature_private_key_file, shacache_ca_file, shacache_cert_file,
shadir_cert_file, shadir_key_file, metadata_dict={}): 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 Upload content of a file descriptor to a network cache server using
shacache/shadir API. shacache/shadir API.
...@@ -41,8 +42,10 @@ def __upload_network_cached(dir_url, cache_url, ...@@ -41,8 +42,10 @@ def __upload_network_cached(dir_url, cache_url,
# convert '' into None in order to call nc nicely # convert '' into None in order to call nc nicely
with NetworkcacheClient(cache_url, dir_url, with NetworkcacheClient(cache_url, dir_url,
signature_private_key_file=signature_private_key_file or None, 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_cert_file=shacache_cert_file or None,
shacache_key_file=shacache_key_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_cert_file=shadir_cert_file or None,
shadir_key_file=shadir_key_file or None, shadir_key_file=shadir_key_file or None,
) as nc: ) as nc:
...@@ -53,15 +56,16 @@ helper_upload_network_cached_from_file = None ...@@ -53,15 +56,16 @@ helper_upload_network_cached_from_file = None
def helper_upload_network_cached_from_directory(dir_url, cache_url, def helper_upload_network_cached_from_directory(dir_url, cache_url,
path, directory_key, metadata_dict, path, directory_key, metadata_dict,
signature_private_key_file, shacache_cert_file, shacache_key_file, signature_private_key_file, shacache_ca_file, shacache_cert_file,
shadir_cert_file, shadir_key_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. Create a tar from a given directory (path) then upload it to networkcache.
""" """
return __upload_network_cached(dir_url, cache_url, return __upload_network_cached(dir_url, cache_url,
NetworkcacheClient.archive(path.rstrip(os.sep)), directory_key, NetworkcacheClient.archive(path.rstrip(os.sep)), directory_key,
signature_private_key_file, shacache_cert_file, shacache_key_file, signature_private_key_file, shacache_ca_file, shacache_cert_file,
shadir_cert_file, shadir_key_file, metadata_dict) shacache_key_file, shadir_ca_file, shadir_cert_file, shadir_key_file,
metadata_dict)
def helper_download_network_cached(dir_url, cache_url, def helper_download_network_cached(dir_url, cache_url,
......
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