swift: Respect the OPENSTACK_SSL_NO_VERIFY setting

The swift API client connection does not respect the
OPENSTACK_SSL_NO_VERIFY setting in the local_settings.py.

As a result a SSL verfication error happens with a
self-signed certificate.

Closes-Bug: #1311357.

Change-Id: I907a8f7c5c631adfaf2ca66385749bb8e86734f2
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2014-04-23 20:19:00 -04:00 committed by Julie Pichon
parent 57e332b8ef
commit 456c69e0b3
2 changed files with 3 additions and 0 deletions

View File

@ -107,6 +107,7 @@ def _metadata_to_header(metadata):
def swift_api(request):
endpoint = base.url_for(request, 'object-store')
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
LOG.debug('Swift connection created using token "%s" and url "%s"'
% (request.user.token.id, endpoint))
return swiftclient.client.Connection(None,
@ -115,6 +116,7 @@ def swift_api(request):
preauthtoken=request.user.token.id,
preauthurl=endpoint,
cacert=cacert,
insecure=insecure,
auth_version="2.0")

View File

@ -347,6 +347,7 @@ class APITestCase(TestCase):
preauthtoken=mox.IgnoreArg(),
preauthurl=mox.IgnoreArg(),
cacert=None,
insecure=False,
auth_version="2.0") \
.AndReturn(self.swiftclient)
expected_calls -= 1