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:
Ekaterina Khripunova 2016-10-17 12:24:25 +03:00
parent 79d6e3c5ac
commit 5328c3168a
2 changed files with 3 additions and 3 deletions

View File

@ -288,7 +288,7 @@ def _adjust_kwargs(kwargs):
if timeout <= 0:
timeout = None
insecure = strutils.bool_from_string(kwargs.get('insecure'))
insecure = strutils.bool_from_string(client_kwargs.get('insecure'))
verify = kwargs.get('verify')
if verify is None:
if insecure:
@ -388,7 +388,7 @@ def get_auth_plugin(endpoint, **kwargs):
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',
'project_name', 'tenant_name',
'user_domain_name', 'user_domain_id',

View File

@ -173,7 +173,7 @@ class ClientTest(utils.BaseTestCase):
def test_v2_client_insecure(self):
env = FAKE_ENV.copy()
env.pop('auth_plugin')
env['insecure'] = 'True'
env['os_insecure'] = 'True'
client = self.create_client(env)
self.assertIn('insecure', client.auth_plugin.opts)
self.assertEqual('True', client.auth_plugin.opts['insecure'])