summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaliki <imran.malik@emc.com>2016-10-17 17:19:17 -0700
committerAbhishek Chanda <abhishek.becs@gmail.com>2016-10-18 04:41:28 +0000
commit14dfc7d61664b03d2b7bed74dd032c60a0d86a19 (patch)
tree0b1e29a77d152c7a8635fd73756bfd97b18c29eb
parentdb984109f8704f06756f5aface1906bf2de2acb8 (diff)
Add missing options for HTTPClient if auth_token given.2.3.1
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 : https://github.com/openstack/python-magnumclient/commit/a374b9f99cabd78f93603860425517d45b6290fa#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 7829c8c901da4cb0e6dd821ca0127ddc93e75442)
Notes
Notes (review): Code-Review+1: Abhishek Chanda <abhishek.becs@gmail.com> Code-Review+1: Imran Hayder Malik <imran.malik@emc.com> Code-Review+2: Madhuri Kumari <madhuri.kumari@intel.com> Code-Review+1: yatin <yatin.karel@nectechnologies.in> Code-Review+2: Hongbin Lu <hongbin.lu@huawei.com> Workflow+1: Hongbin Lu <hongbin.lu@huawei.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 18 Oct 2016 22:25:42 +0000 Reviewed-on: https://review.openstack.org/387789 Project: openstack/python-magnumclient Branch: refs/heads/stable/newton
-rw-r--r--magnumclient/tests/v1/test_client.py6
-rw-r--r--magnumclient/v1/client.py2
2 files changed, 8 insertions, 0 deletions
diff --git a/magnumclient/tests/v1/test_client.py b/magnumclient/tests/v1/test_client.py
index ed6c36f..6de0079 100644
--- a/magnumclient/tests/v1/test_client.py
+++ b/magnumclient/tests/v1/test_client.py
@@ -132,16 +132,22 @@ class ClientInitializeTest(testtools.TestCase):
132 expected_token = 'expected_password' 132 expected_token = 'expected_password'
133 expected_magnum_url = 'expected_magnum_url' 133 expected_magnum_url = 'expected_magnum_url'
134 expected_api_version = 'expected_api_version' 134 expected_api_version = 'expected_api_version'
135 expected_insecure = False
136 expected_timeout = 600
135 expected_kwargs = {'expected_key': 'expected_value'} 137 expected_kwargs = {'expected_key': 'expected_value'}
136 client.Client(auth_token=expected_token, 138 client.Client(auth_token=expected_token,
137 magnum_url=expected_magnum_url, 139 magnum_url=expected_magnum_url,
138 api_version=expected_api_version, 140 api_version=expected_api_version,
141 timeout=expected_timeout,
142 insecure=expected_insecure,
139 **expected_kwargs) 143 **expected_kwargs)
140 144
141 mock_http_client.assert_called_once_with( 145 mock_http_client.assert_called_once_with(
142 expected_magnum_url, 146 expected_magnum_url,
143 token=expected_token, 147 token=expected_token,
144 api_version=expected_api_version, 148 api_version=expected_api_version,
149 timeout=expected_timeout,
150 insecure=expected_insecure,
145 **expected_kwargs) 151 **expected_kwargs)
146 152
147 def _test_init_with_interface(self, 153 def _test_init_with_interface(self,
diff --git a/magnumclient/v1/client.py b/magnumclient/v1/client.py
index 83e1571..a00be5f 100644
--- a/magnumclient/v1/client.py
+++ b/magnumclient/v1/client.py
@@ -162,6 +162,8 @@ class Client(object):
162 endpoint_override, 162 endpoint_override,
163 token=auth_token, 163 token=auth_token,
164 api_version=api_version, 164 api_version=api_version,
165 timeout=timeout,
166 insecure=insecure,
165 **kwargs 167 **kwargs
166 ) 168 )
167 else: 169 else: