summaryrefslogtreecommitdiff
path: root/ironic_python_agent/errors.py
diff options
context:
space:
mode:
authorJosh Gachnang <josh@pcsforeducation.com>2015-08-26 12:47:43 -0700
committerJosh Gachnang <josh@pcsforeducation.com>2015-09-21 15:54:02 -0700
commite17129dbad25a4deb833e2efc7301c97187d3ed7 (patch)
treeb96c8f25c652c48a66aa6c58ee243a7e99536a90 /ironic_python_agent/errors.py
parent9783c6477daa94094358d119f51ce4e07a7d58dc (diff)
downloadironic-python-agent-e17129dbad25a4deb833e2efc7301c97187d3ed7.tar.gz
Add more info to checksum exception
If an image cannot be downloaded for some reason, it is helpful for operators to have the image path, checksum, and calculated checksums available easily from the API. Change-Id: I6a2fb46726245cebd730b5c51d4f25f8465f1658
Diffstat (limited to 'ironic_python_agent/errors.py')
-rw-r--r--ironic_python_agent/errors.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/ironic_python_agent/errors.py b/ironic_python_agent/errors.py
index f551c95b..92c3825f 100644
--- a/ironic_python_agent/errors.py
+++ b/ironic_python_agent/errors.py
@@ -150,10 +150,14 @@ class ImageChecksumError(RESTError):
"""Error raised when an image fails to verify against its checksum."""
message = 'Error verifying image checksum'
-
- def __init__(self, image_id):
- details = 'Image with id {0} failed to verify against checksum.'
- details = details.format(image_id)
+ details_str = ('Image failed to verify against checksum. location: {0}; '
+ 'image ID: {1}; image checksum: {2}; verification '
+ 'checksum: {3}')
+
+ def __init__(self, image_id, image_location, checksum,
+ calculated_checksum):
+ details = self.details_str.format(image_location, image_id, checksum,
+ calculated_checksum)
super(ImageChecksumError, self).__init__(details)