Update glance_http for SSL

Update the cacert variable name to ca_certs in glance_http in order for the
certificate to be properly passed on.

Change-Id: If1607b38eef5dbdeb351ba1e9816b92640dfc0c2
Closes-bug: #1413169
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 5f35c85..92ed8f1 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -67,7 +67,7 @@
         _kwargs = {'timeout': float(kwargs.get('timeout', 600))}
 
         if scheme == 'https':
-            _kwargs['cacert'] = kwargs.get('cacert', None)
+            _kwargs['ca_certs'] = kwargs.get('ca_certs', None)
             _kwargs['cert_file'] = kwargs.get('cert_file', None)
             _kwargs['key_file'] = kwargs.get('key_file', None)
             _kwargs['insecure'] = kwargs.get('insecure', False)
@@ -232,7 +232,7 @@
           with native Python 3.3 code.
     """
     def __init__(self, host, port=None, key_file=None, cert_file=None,
-                 cacert=None, timeout=None, insecure=False,
+                 ca_certs=None, timeout=None, insecure=False,
                  ssl_compression=True):
         httplib.HTTPSConnection.__init__(self, host, port,
                                          key_file=key_file,
@@ -242,7 +242,7 @@
         self.timeout = timeout
         self.insecure = insecure
         self.ssl_compression = ssl_compression
-        self.cacert = cacert
+        self.ca_certs = ca_certs
         self.setcontext()
 
     @staticmethod
@@ -326,11 +326,11 @@
                 msg = 'Unable to load key from "%s" %s' % (self.key_file, e)
                 raise exc.SSLConfigurationError(msg)
 
-        if self.cacert:
+        if self.ca_certs:
             try:
-                self.context.load_verify_locations(self.cacert)
+                self.context.load_verify_locations(self.ca_certs)
             except Exception as e:
-                msg = 'Unable to load CA from "%s"' % (self.cacert, e)
+                msg = 'Unable to load CA from "%s"' % (self.ca_certs, e)
                 raise exc.SSLConfigurationError(msg)
         else:
             self.context.set_default_verify_paths()
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index 9a6c9de..c92a886 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -171,7 +171,7 @@
 
     def test_get_connection_kwargs_set_timeout_for_http(self):
         kwargs = self.client.get_connection_kwargs('http', timeout=10,
-                                                   cacert='foo')
+                                                   ca_certs='foo')
         self.assertEqual(10, kwargs['timeout'])
         # nothing more than timeout is evaluated for http connections
         self.assertEqual(1, len(kwargs.keys()))
@@ -179,7 +179,7 @@
     def test_get_connection_kwargs_default_for_https(self):
         kwargs = self.client.get_connection_kwargs('https')
         self.assertEqual(600, kwargs['timeout'])
-        self.assertEqual(None, kwargs['cacert'])
+        self.assertEqual(None, kwargs['ca_certs'])
         self.assertEqual(None, kwargs['cert_file'])
         self.assertEqual(None, kwargs['key_file'])
         self.assertEqual(False, kwargs['insecure'])
@@ -188,13 +188,13 @@
 
     def test_get_connection_kwargs_set_params_for_https(self):
         kwargs = self.client.get_connection_kwargs('https', timeout=10,
-                                                   cacert='foo',
+                                                   ca_certs='foo',
                                                    cert_file='/foo/bar.cert',
                                                    key_file='/foo/key.pem',
                                                    insecure=True,
                                                    ssl_compression=False)
         self.assertEqual(10, kwargs['timeout'])
-        self.assertEqual('foo', kwargs['cacert'])
+        self.assertEqual('foo', kwargs['ca_certs'])
         self.assertEqual('/foo/bar.cert', kwargs['cert_file'])
         self.assertEqual('/foo/key.pem', kwargs['key_file'])
         self.assertEqual(True, kwargs['insecure'])