Browse Source

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
changes/54/677954/2
chenhb 6 months ago
parent
commit
32bbc091bb
2 changed files with 4 additions and 2 deletions
  1. +2
    -1
      rally_openstack/services/image/glance_v2.py
  2. +2
    -1
      tests/unit/services/image/test_glance_v2.py

+ 2
- 1
rally_openstack/services/image/glance_v2.py View File

@@ -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:

+ 2
- 1
tests/unit/services/image/test_glance_v2.py View File

@@ -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)


Loading…
Cancel
Save