Fixes SSLError during cclient.meters.list() by https
The problem causes the function _adjust_kwargs(kwargs) which creates a new dict client_kwargs with new-named keys. It gets 'os_insecure' key from kwargs and gives it key-name 'insecure'. But the bug is in using kwargs.get('insecure') <which is None> to produse value of 'verify'. Change-Id: If77b2d3c75beddcd1a0a82353b56c84b29184ec7 Closes-Bug: 1634027 Related-Bug: 1394449
This commit is contained in:
parent
79d6e3c5ac
commit
5328c3168a
|
@ -288,7 +288,7 @@ def _adjust_kwargs(kwargs):
|
||||||
if timeout <= 0:
|
if timeout <= 0:
|
||||||
timeout = None
|
timeout = None
|
||||||
|
|
||||||
insecure = strutils.bool_from_string(kwargs.get('insecure'))
|
insecure = strutils.bool_from_string(client_kwargs.get('insecure'))
|
||||||
verify = kwargs.get('verify')
|
verify = kwargs.get('verify')
|
||||||
if verify is None:
|
if verify is None:
|
||||||
if insecure:
|
if insecure:
|
||||||
|
@ -388,7 +388,7 @@ def get_auth_plugin(endpoint, **kwargs):
|
||||||
return auth_plugin
|
return auth_plugin
|
||||||
|
|
||||||
|
|
||||||
LEGACY_OPTS = ('auth_plugin', 'auth_url', 'token', 'insecure', 'cacert',
|
LEGACY_OPTS = ('auth_plugin', 'auth_url', 'token', 'insecure', 'cacert',
|
||||||
'tenant_id', 'project_id', 'username', 'password',
|
'tenant_id', 'project_id', 'username', 'password',
|
||||||
'project_name', 'tenant_name',
|
'project_name', 'tenant_name',
|
||||||
'user_domain_name', 'user_domain_id',
|
'user_domain_name', 'user_domain_id',
|
||||||
|
|
|
@ -173,7 +173,7 @@ class ClientTest(utils.BaseTestCase):
|
||||||
def test_v2_client_insecure(self):
|
def test_v2_client_insecure(self):
|
||||||
env = FAKE_ENV.copy()
|
env = FAKE_ENV.copy()
|
||||||
env.pop('auth_plugin')
|
env.pop('auth_plugin')
|
||||||
env['insecure'] = 'True'
|
env['os_insecure'] = 'True'
|
||||||
client = self.create_client(env)
|
client = self.create_client(env)
|
||||||
self.assertIn('insecure', client.auth_plugin.opts)
|
self.assertIn('insecure', client.auth_plugin.opts)
|
||||||
self.assertEqual('True', client.auth_plugin.opts['insecure'])
|
self.assertEqual('True', client.auth_plugin.opts['insecure'])
|
||||||
|
|
Loading…
Reference in New Issue