From 32bbc091bbce1db625a2fc22da28b32718befa13 Mon Sep 17 00:00:00 2001 From: chenhb Date: Thu, 22 Aug 2019 19:08:10 +0800 Subject: [PATCH] Support to upload an image which is from a https server Looks there is not a better way, As a simple solution, do not verify the CA file. Change-Id: I6ba87ce7cffdf4d150fc69470414555648248ebe --- rally_openstack/services/image/glance_v2.py | 3 ++- tests/unit/services/image/test_glance_v2.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rally_openstack/services/image/glance_v2.py b/rally_openstack/services/image/glance_v2.py index 0bd8e171..7e6226c4 100644 --- a/rally_openstack/services/image/glance_v2.py +++ b/rally_openstack/services/image/glance_v2.py @@ -46,7 +46,8 @@ class GlanceV2Service(service.Service, glance_common.GlanceMixin): if os.path.isfile(image_location): image_data = open(image_location, "rb") else: - response = requests.get(image_location, stream=True) + response = requests.get(image_location, stream=True, + verify=False) image_data = response.raw self._clients.glance("2").images.upload(image_id, image_data) finally: diff --git a/tests/unit/services/image/test_glance_v2.py b/tests/unit/services/image/test_glance_v2.py index e253da9e..7972a397 100644 --- a/tests/unit/services/image/test_glance_v2.py +++ b/tests/unit/services/image/test_glance_v2.py @@ -54,7 +54,8 @@ class GlanceV2ServiceTestCase(test.TestCase): self.service.upload_data(image_id, image_location=location) - mock_requests_get.assert_called_once_with(location, stream=True) + mock_requests_get.assert_called_once_with(location, stream=True, + verify=False) self.gc.images.upload.assert_called_once_with( image_id, mock_requests_get.return_value.raw)