From e17129dbad25a4deb833e2efc7301c97187d3ed7 Mon Sep 17 00:00:00 2001 From: Josh Gachnang Date: Wed, 26 Aug 2015 12:47:43 -0700 Subject: 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 --- ironic_python_agent/errors.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ironic_python_agent/errors.py') 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) -- cgit v1.2.1