Commit e9a578c5 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

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

parent c5036bf4
......@@ -435,8 +435,10 @@ class Buildout(UserDict.DictMixin):
self.upload_dir_url = None
self.signature_private_key_file = None
self.signature_certificate_list = None
self.shacache_ca_file = None
self.shacache_cert_file = None
self.shacache_key_file = None
self.shadir_ca_file = None
self.shadir_cert_file = None
self.shadir_key_file = None
else:
......@@ -456,10 +458,14 @@ class Buildout(UserDict.DictMixin):
'signature-certificate-list', '')
self.signature_private_key_file = networkcache_section.get(
'signature-private-key-file', '')
self.shacache_ca_file = networkcache_section.get(
'shacache-ca-file', '')
self.shacache_cert_file = networkcache_section.get(
'shacache-cert-file', '')
self.shacache_key_file = networkcache_section.get(
'shacache-key-file', '')
self.shadir_ca_file = networkcache_section.get(
'shadir-ca-file', '')
self.shadir_cert_file = networkcache_section.get(
'shadir-cert-file', '')
self.shadir_key_file = networkcache_section.get(
......@@ -483,8 +489,10 @@ class Buildout(UserDict.DictMixin):
options['__networkcache__upload-dir-url'] = self.upload_dir_url
options['__networkcache__signature-certificate-list'] = signature_certificate_list
options['__networkcache__signature-private-key-file'] = self.signature_private_key_file
options['__networkcache__shacache-ca-file'] = self.shacache_ca_file
options['__networkcache__shacache-cert-file'] = self.shacache_cert_file
options['__networkcache__shacache-key-file'] = self.shacache_key_file
options['__networkcache__shadir-ca-file'] = self.shadir_ca_file
options['__networkcache__shadir-cert-file'] = self.shadir_cert_file
options['__networkcache__shadir-key-file'] = self.shadir_key_file
......@@ -497,8 +505,10 @@ class Buildout(UserDict.DictMixin):
self.upload_dir_url = None
self.signature_private_key_file = None
self.signature_certificate_list = None
self.shacache_ca_file = None
self.shacache_cert_file = None
self.shacache_key_file = None
self.shadir_ca_file = None
self.shadir_cert_file = None
self.shadir_key_file = None
......@@ -542,8 +552,10 @@ class Buildout(UserDict.DictMixin):
upload_dir_url=self.upload_dir_url,
signature_private_key_file=self.signature_private_key_file,
signature_certificate_list=self.signature_certificate_list,
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,
)
......@@ -1066,8 +1078,10 @@ class Buildout(UserDict.DictMixin):
upload_dir_url=self.upload_dir_url,
signature_certificate_list=self.signature_certificate_list,
signature_private_key_file=self.signature_private_key_file,
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,
)
......@@ -1192,8 +1206,10 @@ class Buildout(UserDict.DictMixin):
upload_dir_url=self.upload_dir_url,
signature_private_key_file=self.signature_private_key_file,
signature_certificate_list=self.signature_certificate_list,
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,)
......@@ -1332,10 +1348,14 @@ def _install_and_load(spec, group, entry, buildout):
signature_private_key_file=buildout_options.get(
'__networkcache__signature-private-key-file'),
signature_certificate_list=signature_certificate_list,
shacache_ca_file=buildout_options.get(
'__networkcache__shacache-ca-file'),
shacache_cert_file=buildout_options.get(
'__networkcache__shacache-cert-file'),
shacache_key_file=buildout_options.get(
'__networkcache__shacache-key-file'),
shadir_ca_file=buildout_options.get(
'__networkcache__shadir-ca-file'),
shadir_cert_file=buildout_options.get(
'__networkcache__shadir-cert-file'),
shadir_key_file=buildout_options.get(
......
......@@ -86,10 +86,14 @@ class Download(object):
if q.strip()]
self.signature_private_key_file = options.get(
'__networkcache__signature-private-key-file')
self.shacache_ca_file = options.get(
'__networkcache__shacache-ca-file')
self.shacache_cert_file = options.get(
'__networkcache__shacache-cert-file')
self.shacache_key_file = options.get(
'__networkcache__shacache-key-file')
self.shadir_ca_file = options.get(
'__networkcache__shadir-ca-file')
self.shadir_cert_file = options.get(
'__networkcache__shadir-cert-file')
self.shadir_key_file = options.get(
......@@ -215,8 +219,10 @@ class Download(object):
upload_network_cached(self.upload_dir_url,
self.upload_cache_url, url, tmp_path, 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)
except IOError, e:
......
......@@ -320,8 +320,10 @@ class AllowHostsPackageIndex(setuptools.package_index.PackageIndex):
upload_index_network_cached(_upload_dir_url,
_upload_cache_url, url, base, self._current_requirement, page, logger,
globals().get('_signature_private_key_file'),
globals().get('_shacache_ca_file'),
globals().get('_shacache_cert_file'),
globals().get('_shacache_key_file'),
globals().get('_shadir_ca_file'),
globals().get('_shadir_cert_file'),
globals().get('_shadir_key_file'))
......@@ -466,8 +468,10 @@ class Installer:
upload_cache_url=None,
signature_certificate_list=None,
signature_private_key_file=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,
):
......@@ -491,12 +495,18 @@ class Installer:
if signature_private_key_file:
global _signature_private_key_file
_signature_private_key_file = signature_private_key_file
if shacache_ca_file:
global _shacache_ca_file
_shacache_ca_file = shacache_ca_file
if shacache_cert_file:
global _shacache_cert_file
_shacache_cert_file = shacache_cert_file
if shacache_key_file:
global _shacache_key_file
_shacache_key_file = shacache_key_file
if shadir_ca_file:
global _shadir_ca_file
_shadir_ca_file = shadir_ca_file
if shadir_cert_file:
global _shadir_cert_file
_shadir_cert_file = shadir_cert_file
......@@ -897,7 +907,8 @@ class Installer:
upload_network_cached(_upload_dir_url,
_upload_cache_url, dist.location, new_location, logger,
_signature_private_key_file,
_shacache_cert_file, _shacache_key_file,
_shacache_ca_file, _shacache_cert_file,
_shacache_key_file, _shadir_ca_file,
_shadir_cert_file, _shadir_key_file)
if (download_cache
......@@ -1304,7 +1315,8 @@ def install(specs, dest,
prefer_final=None, download_dir_url=None, download_cache_url=None,
upload_dir_url=None, upload_cache_url=None,
signature_certificate_list=None, signature_private_key_file=None,
shacache_cert_file=None, shacache_key_file=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, patch_dict=None):
installer = Installer(
dest, links, index, executable, always_unzip, path, newest,
......@@ -1316,8 +1328,10 @@ def install(specs, dest,
upload_cache_url=upload_cache_url,
signature_certificate_list=signature_certificate_list,
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)
return installer.install(specs, working_set, patch_dict=patch_dict)
......
......@@ -163,8 +163,8 @@ def download_index_network_cached(dir_url, cache_url, url, requirement, logger,
@fallback_call
def upload_network_cached(dir_url, cache_url, external_url, path, logger,
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):
"""Upload file to a network cache server"""
# XXX use helper and FACTOR code
if not LIBNETWORKCACHE_ENABLED:
......@@ -185,10 +185,14 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
# 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:
......@@ -196,8 +200,10 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
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:
......@@ -218,8 +224,8 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
@fallback_call
def upload_index_network_cached(dir_url, cache_url, external_url, base, requirement, content, logger,
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):
# XXX use helper and FACTOR code
"""Upload content of a web page to a network cache server"""
if not LIBNETWORKCACHE_ENABLED:
......@@ -243,10 +249,14 @@ def upload_index_network_cached(dir_url, cache_url, external_url, base, requirem
# 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:
......@@ -254,8 +264,10 @@ def upload_index_network_cached(dir_url, cache_url, external_url, base, requirem
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:
......
......@@ -703,8 +703,10 @@ that proper keys are used.
>>> write(sample_buildout, 'ncpatch', 'ncpatch.py',
... """
... def patched(self, *args, **kwargs):
... print 'shacache_ca_file', self.shacache_ca_file
... print 'shacache_cert_file', self.shacache_cert_file
... print 'shacache_key_file', self.shacache_key_file
... print 'shadir_ca_file', self.shadir_ca_file
... print 'shadir_cert_file', self.shadir_cert_file
... print 'shadir_key_file', self.shadir_key_file
... return False
......@@ -780,8 +782,10 @@ And see what happens:
Downloading hello.txt from network cache.
Failed to download from network cache hello.txt:...404...
Uploading http://localhost/hello.txt into network cache.
shacache_ca_file /path/to/shacache/ca/file
shacache_cert_file /path/to/shacache/cert/file
shacache_key_file /path/to/shacache/key/file
shadir_ca_file /path/to/shadir/ca/file
shadir_cert_file /path/to/shadir/cert/file
shadir_key_file /path/to/shadir/key/file
download: Downloaded http://localhost/hello.txt
......
......@@ -123,8 +123,10 @@ class Eggs(object):
('__networkcache__upload-dir-url', 'upload_dir_url'),
('__networkcache__signature-private-key-file', 'signature_private_key_file'),
('__networkcache__signature-certificate-list', 'signature_certificate_list'),
('__networkcache__shacache-ca-file', 'shacache_ca_file'),
('__networkcache__shacache-cert-file', 'shacache_cert_file'),
('__networkcache__shacache-key-file', 'shacache_key_file'),
('__networkcache__shadir-ca-file', 'shadir_ca_file'),
('__networkcache__shadir-cert-file', 'shadir_cert_file'),
('__networkcache__shadir-key-file', 'shadir_key_file'),
):
......
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