Stop passing raw Exceptions as the reasons for ironic Image exceptions
When an exception occured in the ironic image service code, the raw exception was passed into the IronicException as the reason. The ironic exception logic then attempted to converted it to json which fails and then falls back to converting it to string. This patch preemptively converts the Exception to string to avoid that first failure. Change-Id: Id3a166a74505c142d7217217882246a64f625eb8
This commit is contained in:
@@ -118,7 +118,7 @@ class HttpImageService(BaseImageService):
|
||||
"HEAD request.") % response.status_code)
|
||||
except requests.RequestException as e:
|
||||
raise exception.ImageRefValidationFailed(image_href=output_url,
|
||||
reason=e)
|
||||
reason=six.text_type(e))
|
||||
return response
|
||||
|
||||
def download(self, image_href, image_file):
|
||||
@@ -143,7 +143,7 @@ class HttpImageService(BaseImageService):
|
||||
shutil.copyfileobj(input_img, image_file, IMAGE_CHUNK_SIZE)
|
||||
except (requests.RequestException, IOError) as e:
|
||||
raise exception.ImageDownloadFailed(image_href=image_href,
|
||||
reason=e)
|
||||
reason=six.text_type(e))
|
||||
|
||||
def show(self, image_href):
|
||||
"""Get dictionary of image properties.
|
||||
@@ -235,7 +235,7 @@ class FileImageService(BaseImageService):
|
||||
0, filesize)
|
||||
except Exception as e:
|
||||
raise exception.ImageDownloadFailed(image_href=image_href,
|
||||
reason=e)
|
||||
reason=six.text_type(e))
|
||||
|
||||
def show(self, image_href):
|
||||
"""Get dictionary of image properties.
|
||||
|
||||
Reference in New Issue
Block a user