Commit 53d0ffe6 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Add default CA certs location to AstakosClient

Refs grnet/kamaki#54
parent 850eb094
......@@ -44,6 +44,9 @@ from kamaki.clients import (
from kamaki.clients.utils import https
log = getLogger(__name__)
class AstakosClientError(ClientError, AstakosClientException):
"""Join AstakosClientException as ClientError in one class"""
......@@ -83,6 +86,16 @@ class AstakosClient(OriginalAstakosClient):
else:
kwargs['auth_url'] = kwargs.get('auth_url', kwargs.get(
'endpoint_url', kwargs['base_url']))
# If no CA certificates are set, get the defaults from kamaki.defaults
if https.HTTPSClientAuthConnection.ca_file is None:
try:
from kamaki import defaults
https.HTTPSClientAuthConnection.ca_file = getattr(
defaults, 'CACERTS_DEFAULT_PATH', None)
except ImportError as ie:
log.debug('ImportError while loading default certs: %s' % ie)
super(AstakosClient, self).__init__(*args, **kwargs)
def get_service_endpoints(self, service_type, version=None):
......
......@@ -36,6 +36,6 @@
# OS-specific settings when packaging kamaki for a platform.
# The default path for the CA certifications file of the host system
CACERTS_DEFAULT_PATH = ''
CACERTS_DEFAULT_PATH = None
# To overwrite any of the above, append new assignments bellow
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