Do not ignore cacert setting
Value of cacert was ignored while creating keystone session Change-Id: I731a18d953c2466b2c26440d5d8b28ac3fbf0137 Closes-Bug: 1577360
This commit is contained in:
parent
fd4881e601
commit
8838a4da0d
|
@ -155,9 +155,9 @@ class OSClient(plugin.Plugin):
|
|||
endpoint = endpoint or self._get_endpoint()
|
||||
kc = self.keystone()
|
||||
auth = token_endpoint.Token(endpoint, kc.auth_token)
|
||||
|
||||
verify = self.credential.cacert or not self.credential.insecure
|
||||
return ks_session.Session(
|
||||
auth=auth, verify=not self.credential.insecure,
|
||||
auth=auth, verify=verify,
|
||||
timeout=CONF.openstack_client_http_timeout)
|
||||
|
||||
def _get_keystoneauth_session(self):
|
||||
|
|
|
@ -297,6 +297,19 @@ class OSClientsTestCase(test.TestCase):
|
|||
auth=fake_auth, verify=not self.credential.insecure,
|
||||
timeout=cfg.CONF.openstack_client_http_timeout)
|
||||
|
||||
@mock.patch("keystoneclient.session.Session")
|
||||
def test_get_session_with_ca(self, mock_session):
|
||||
# Use DummyClient since if not the abc meta kicks in
|
||||
osc = DummyClient(self.credential, {}, {})
|
||||
|
||||
self.credential.cacert = "/fake/ca"
|
||||
fake_auth = mock.Mock()
|
||||
osc._get_session(auth=fake_auth)
|
||||
|
||||
mock_session.assert_called_once_with(
|
||||
auth=fake_auth, verify="/fake/ca",
|
||||
timeout=cfg.CONF.openstack_client_http_timeout)
|
||||
|
||||
def test_keystone(self):
|
||||
self.assertNotIn("keystone", self.clients.cache)
|
||||
client = self.clients.keystone()
|
||||
|
|
Loading…
Reference in New Issue