From 14dfc7d61664b03d2b7bed74dd032c60a0d86a19 Mon Sep 17 00:00:00 2001 From: maliki Date: Mon, 17 Oct 2016 17:19:17 -0700 Subject: [PATCH] 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 : 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) --- magnumclient/tests/v1/test_client.py | 6 ++++++ magnumclient/v1/client.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/magnumclient/tests/v1/test_client.py b/magnumclient/tests/v1/test_client.py index ed6c36f9..6de0079c 100644 --- a/magnumclient/tests/v1/test_client.py +++ b/magnumclient/tests/v1/test_client.py @@ -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, diff --git a/magnumclient/v1/client.py b/magnumclient/v1/client.py index 83e1571a..a00be5f8 100644 --- a/magnumclient/v1/client.py +++ b/magnumclient/v1/client.py @@ -162,6 +162,8 @@ class Client(object): endpoint_override, token=auth_token, api_version=api_version, + timeout=timeout, + insecure=insecure, **kwargs ) else: