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
This commit is contained in:
parent
33da0db504
commit
32bbc091bb
@ -46,7 +46,8 @@ class GlanceV2Service(service.Service, glance_common.GlanceMixin):
|
|||||||
if os.path.isfile(image_location):
|
if os.path.isfile(image_location):
|
||||||
image_data = open(image_location, "rb")
|
image_data = open(image_location, "rb")
|
||||||
else:
|
else:
|
||||||
response = requests.get(image_location, stream=True)
|
response = requests.get(image_location, stream=True,
|
||||||
|
verify=False)
|
||||||
image_data = response.raw
|
image_data = response.raw
|
||||||
self._clients.glance("2").images.upload(image_id, image_data)
|
self._clients.glance("2").images.upload(image_id, image_data)
|
||||||
finally:
|
finally:
|
||||||
|
@ -54,7 +54,8 @@ class GlanceV2ServiceTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.service.upload_data(image_id, image_location=location)
|
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(
|
self.gc.images.upload.assert_called_once_with(
|
||||||
image_id, mock_requests_get.return_value.raw)
|
image_id, mock_requests_get.return_value.raw)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user