Commit 5d688f16 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add shacache-ca-file and shadir-ca-file options.

parent 6f14fd1e
......@@ -38,11 +38,13 @@ download-binary-dir-url = http://www.shacache.org/shadir
#signature_private_key_file = /etc/opt/slapos/shacache/signature.key
#signature_certificate_file = /etc/opt/slapos/shacache/signature.cert
#upload-cache-url = https://www.shacache.org/shacache
#shacache-ca-file = /etc/opt/slapos/shacache/ca.cert
#shacache-cert-file = /etc/opt/slapos/shacache/shacache.cert
#shacache-key-file = /etc/opt/slapos/shacache/shacache.key
#upload-binary-dir-url = https://www.shacache.org/shadir
#upload-binary-cache-url = https://www.shacache.org/shacache
#upload-dir-url = https://www.shacache.org/shadir
#shadir-ca-file = /etc/opt/slapos/shacache/ca.cert
#shadir-cert-file = /etc/opt/slapos/shacache/shacache.cert
#shadir-key-file = /etc/opt/slapos/shacache/shacache.key
......
......@@ -103,8 +103,9 @@ class Software(object):
# The key is an url in the case of Buildout.
def __init__(self, url, software_root, buildout, logger,
signature_private_key_file=None, signature_certificate_list=None,
upload_cache_url=None, upload_dir_url=None, shacache_cert_file=None,
shacache_key_file=None, shadir_cert_file=None, shadir_key_file=None,
upload_cache_url=None, upload_dir_url=None,
shacache_ca_file=None, shacache_cert_file=None, shacache_key_file=None,
shadir_ca_file=None, shadir_cert_file=None, shadir_key_file=None,
download_binary_cache_url=None, upload_binary_cache_url=None,
download_binary_dir_url=None, upload_binary_dir_url=None,
download_from_binary_cache_url_blacklist=None,
......@@ -130,8 +131,10 @@ class Software(object):
self.signature_certificate_list = signature_certificate_list
self.upload_cache_url = upload_cache_url
self.upload_dir_url = upload_dir_url
self.shacache_ca_file = shacache_ca_file
self.shacache_cert_file = shacache_cert_file
self.shacache_key_file = shacache_key_file
self.shadir_ca_file = shadir_ca_file
self.shadir_cert_file = shadir_cert_file
self.shadir_key_file = shadir_key_file
self.download_binary_cache_url = download_binary_cache_url
......@@ -224,8 +227,10 @@ class Software(object):
('signature-private-key-file', self.signature_private_key_file),
('upload-cache-url', self.upload_cache_url),
('upload-dir-url', self.upload_dir_url),
('shacache-ca-file', self.shacache_ca_file),
('shacache-cert-file', self.shacache_cert_file),
('shacache-key-file', self.shacache_key_file),
('shadir-ca-file', self.shadir_ca_file),
('shadir-cert-file', self.shadir_cert_file),
('shadir-key-file', self.shadir_key_file)
]:
......@@ -296,8 +301,10 @@ class Software(object):
self.upload_binary_dir_url,
tarpath, self.logger,
self.signature_private_key_file,
self.shacache_ca_file,
self.shacache_cert_file,
self.shacache_key_file,
self.shadir_ca_file,
self.shadir_cert_file,
self.shadir_key_file)
......
......@@ -116,7 +116,8 @@ def download_network_cached(cache_url, dir_url, software_url, software_root,
@fallback_call
def upload_network_cached(software_root, software_url, cached_key,
cache_url, dir_url, path, logger, signature_private_key_file,
shacache_cert_file, shacache_key_file, shadir_cert_file, shadir_key_file):
shacache_ca_file, shacache_cert_file, shacache_key_file,
shadir_ca_file, shadir_cert_file, shadir_key_file):
"""Upload file to a network cache server"""
if not LIBNETWORKCACHE_ENABLED:
return False
......@@ -141,10 +142,14 @@ def upload_network_cached(software_root, software_url, cached_key,
# convert '' into None in order to call nc nicely
if not signature_private_key_file:
signature_private_key_file = None
if not shacache_ca_file:
shacache_ca_file = None
if not shacache_cert_file:
shacache_cert_file = None
if not shacache_key_file:
shacache_key_file = None
if not shadir_ca_file:
shadir_ca_file = None
if not shadir_cert_file:
shadir_cert_file = None
if not shadir_key_file:
......@@ -152,8 +157,10 @@ def upload_network_cached(software_root, software_url, cached_key,
try:
nc = NetworkcacheClient(cache_url, dir_url,
signature_private_key_file=signature_private_key_file,
shacache_ca_file=shacache_ca_file,
shacache_cert_file=shacache_cert_file,
shacache_key_file=shacache_key_file,
shadir_ca_file=shadir_ca_file,
shadir_cert_file=shadir_cert_file,
shadir_key_file=shadir_key_file)
except TypeError:
......
......@@ -118,8 +118,10 @@ def check_missing_files(options):
options.get('key_file'),
options.get('cert_file'),
options.get('master_ca_file'),
options.get('shacache-ca-file'),
options.get('shacache-cert-file'),
options.get('shacache-key-file'),
options.get('shadir-ca-file'),
options.get('shadir-cert-file'),
options.get('shadir-key-file'),
options.get('signature_private_key_file')
......@@ -221,8 +223,10 @@ def create_slapgrid_object(options, logger):
master_ca_file=op.get('master_ca_file'),
certificate_repository_path=op.get('certificate_repository_path'),
promise_timeout=op.get('promise_timeout', PROMISE_TIMEOUT),
shacache_ca_file=op.get('shacache-ca-file'),
shacache_cert_file=op.get('shacache-cert-file'),
shacache_key_file=op.get('shacache-key-file'),
shadir_ca_file=op.get('shadir-ca-file'),
shadir_cert_file=op.get('shadir-cert-file'),
shadir_key_file=op.get('shadir-key-file'),
forbid_supervisord_automatic_launch=string_to_boolean(op.get('forbid_supervisord_automatic_launch', 'false')),
......@@ -278,8 +282,10 @@ class Slapgrid(object):
master_ca_file=None,
certificate_repository_path=None,
promise_timeout=3,
shacache_ca_file=None,
shacache_cert_file=None,
shacache_key_file=None,
shadir_ca_file=None,
shadir_cert_file=None,
shadir_key_file=None,
forbid_supervisord_automatic_launch=False,
......@@ -314,8 +320,10 @@ class Slapgrid(object):
self.download_binary_dir_url = download_binary_dir_url
self.upload_binary_dir_url = upload_binary_dir_url
self.upload_dir_url = upload_dir_url
self.shacache_ca_file = shacache_ca_file
self.shacache_cert_file = shacache_cert_file
self.shacache_key_file = shacache_key_file
self.shadir_ca_file = shadir_ca_file
self.shadir_cert_file = shadir_cert_file
self.shadir_key_file = shadir_key_file
self.forbid_supervisord_automatic_launch = forbid_supervisord_automatic_launch
......@@ -410,8 +418,10 @@ class Slapgrid(object):
download_binary_dir_url=self.download_binary_dir_url,
upload_binary_dir_url=self.upload_binary_dir_url,
upload_dir_url=self.upload_dir_url,
shacache_ca_file=self.shacache_ca_file,
shacache_cert_file=self.shacache_cert_file,
shacache_key_file=self.shacache_key_file,
shadir_ca_file=self.shadir_ca_file,
shadir_cert_file=self.shadir_cert_file,
shadir_key_file=self.shadir_key_file,
software_min_free_space=self.software_min_free_space)
......
......@@ -190,8 +190,10 @@ class TestSoftwareNetworkCacheSlapObject(MasterMixin, unittest.TestCase):
self.signature_private_key_file = '/signature/private/key_file'
self.upload_cache_url = 'http://example.com/uploadcache'
self.upload_dir_url = 'http://example.com/uploaddir'
self.shacache_ca_file = '/path/to/shacache/ca/file'
self.shacache_cert_file = '/path/to/shacache/cert/file'
self.shacache_key_file = '/path/to/shacache/key/file'
self.shadir_ca_file = '/path/to/shadir/ca/file'
self.shadir_cert_file = '/path/to/shadir/cert/file'
self.shadir_key_file = '/path/to/shadir/key/file'
......@@ -215,8 +217,10 @@ class TestSoftwareNetworkCacheSlapObject(MasterMixin, unittest.TestCase):
signature_private_key_file='/signature/private/key_file',
upload_cache_url='http://example.com/uploadcache',
upload_dir_url='http://example.com/uploaddir',
shacache_ca_file=self.shacache_ca_file,
shacache_cert_file=self.shacache_cert_file,
shacache_key_file=self.shacache_key_file,
shadir_ca_file=self.shadir_ca_file,
shadir_cert_file=self.shadir_cert_file,
shadir_key_file=self.shadir_key_file)
......@@ -227,8 +231,10 @@ class TestSoftwareNetworkCacheSlapObject(MasterMixin, unittest.TestCase):
self.assertIn('networkcache:signature-private-key-file=%s' % self.signature_private_key_file, command_list)
self.assertIn('networkcache:upload-cache-url=%s' % self.upload_cache_url, command_list)
self.assertIn('networkcache:upload-dir-url=%s' % self.upload_dir_url, command_list)
self.assertIn('networkcache:shacache-ca-file=%s' % self.shacache_ca_file, command_list)
self.assertIn('networkcache:shacache-cert-file=%s' % self.shacache_cert_file, command_list)
self.assertIn('networkcache:shacache-key-file=%s' % self.shacache_key_file, command_list)
self.assertIn('networkcache:shadir-ca-file=%s' % self.shadir_ca_file, command_list)
self.assertIn('networkcache:shadir-cert-file=%s' % self.shadir_cert_file, command_list)
self.assertIn('networkcache:shadir-key-file=%s' % self.shadir_key_file, command_list)
......@@ -278,8 +284,10 @@ class TestSoftwareNetworkCacheSlapObject(MasterMixin, unittest.TestCase):
signature_private_key_file='/signature/private/key_file',
upload_cache_url='http://example.com/uploadcache',
upload_dir_url='http://example.com/uploaddir',
shacache_ca_file=self.shacache_ca_file,
shacache_cert_file=self.shacache_cert_file,
shacache_key_file=self.shacache_key_file,
shadir_ca_file=self.shadir_ca_file,
shadir_cert_file=self.shadir_cert_file,
shadir_key_file=self.shadir_key_file,
upload_to_binary_cache_url_blacklist=
......@@ -313,8 +321,10 @@ class TestSoftwareNetworkCacheSlapObject(MasterMixin, unittest.TestCase):
upload_dir_url='http://example.com/uploaddir',
upload_binary_cache_url='http://example.com/uploadcache',
upload_binary_dir_url='http://example.com/uploaddir',
shacache_ca_file=self.shacache_ca_file,
shacache_cert_file=self.shacache_cert_file,
shacache_key_file=self.shacache_key_file,
shadir_ca_file=self.shadir_ca_file,
shadir_cert_file=self.shadir_cert_file,
shadir_key_file=self.shadir_key_file,
upload_to_binary_cache_url_blacklist=
......
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