Modify config field to use base api endpoint

allow streaming from gzipped tarball config
This commit is contained in:
Sam Chow 2018-06-21 15:55:17 -04:00
parent aff1a08a83
commit d6d0bb640a
7 changed files with 40 additions and 33 deletions

View file

@ -36,8 +36,8 @@ class SuperUserCustomCertificate(ApiResource):
# Validate the certificate.
try:
logger.debug('Loading custom certificate %s', certpath)
cert = config_provider.get_volume_file(cert_full_path)
load_certificate(cert)
with config_provider.get_volume_file(cert_full_path) as f:
load_certificate(f.read())
except CertInvalidException:
logger.exception('Got certificate invalid error for cert %s', certpath)
return '', 204
@ -70,13 +70,14 @@ class SuperUserCustomCertificates(ApiResource):
cert_views = []
for extra_cert_path in extra_certs_found:
try:
cert = config_provider.get_volume_file(extra_cert_path)
certificate = load_certificate(cert)
cert_views.append({
'path': extra_cert_path,
'names': list(certificate.names),
'expired': certificate.expired,
})
cert_full_path = config_provider.get_volume_path(EXTRA_CA_DIRECTORY, extra_cert_path)
with config_provider.get_volume_file(cert_full_path) as f:
certificate = load_certificate(f.read())
cert_views.append({
'path': extra_cert_path,
'names': list(certificate.names),
'expired': certificate.expired,
})
except CertInvalidException as cie:
cert_views.append({
'path': extra_cert_path,