Add missing options for HTTPClient if auth_token given.

The insecure client options and timeout were bypassed
if auth token was given, as in case of Magnum UI.
This is causing SSL error even insecure is set to true
by Magnum UI and magnum client is unable to skip SSL check
becuase insecure option was not passed to HTTPClient.
This was caused due to this change :
a374b9f99c (diff-c8d8ebbd1f15e85c914906c6357e0a5f)
As a consequence, any HTTPS based connections to magnum endpoint
fail. With this patch, the missing options to HTTPClient are
correctly passed to and SSL checks are skipped safely if insecure
is set to True.

Change-Id: I885301d6eb69182f109cdfbfbc771bbbf13beb2a
Closes-Bug: #1634305
(cherry picked from commit 7829c8c901)
This commit is contained in:
maliki 2016-10-17 17:19:17 -07:00 committed by Abhishek Chanda
parent db984109f8
commit 14dfc7d616
2 changed files with 8 additions and 0 deletions

View File

@ -132,16 +132,22 @@ class ClientInitializeTest(testtools.TestCase):
expected_token = 'expected_password'
expected_magnum_url = 'expected_magnum_url'
expected_api_version = 'expected_api_version'
expected_insecure = False
expected_timeout = 600
expected_kwargs = {'expected_key': 'expected_value'}
client.Client(auth_token=expected_token,
magnum_url=expected_magnum_url,
api_version=expected_api_version,
timeout=expected_timeout,
insecure=expected_insecure,
**expected_kwargs)
mock_http_client.assert_called_once_with(
expected_magnum_url,
token=expected_token,
api_version=expected_api_version,
timeout=expected_timeout,
insecure=expected_insecure,
**expected_kwargs)
def _test_init_with_interface(self,

View File

@ -162,6 +162,8 @@ class Client(object):
endpoint_override,
token=auth_token,
api_version=api_version,
timeout=timeout,
insecure=insecure,
**kwargs
)
else: