Merge "fix: use the correct path to the image when deep image inspection is off"
This commit is contained in:
@@ -527,12 +527,13 @@ def image_to_raw(image_href, path, path_tmp):
|
||||
'format': fmt})
|
||||
raise exception.InvalidImage()
|
||||
else:
|
||||
fmt = get_source_format(image_href, path)
|
||||
fmt = get_source_format(image_href, path_tmp)
|
||||
LOG.warning("Security: Image safety checking has been disabled. "
|
||||
"This is unsafe operation. Attempting to continue "
|
||||
"the detected format %(img_fmt)s for %(path)s.",
|
||||
"with the detected format %(img_fmt)s for "
|
||||
"image %(image_href)s.",
|
||||
{'img_fmt': fmt,
|
||||
'path': path})
|
||||
'image_href': image_href})
|
||||
|
||||
if fmt not in RAW_IMAGE_FORMATS and fmt != "iso":
|
||||
# When the target format is NOT raw, we need to convert it.
|
||||
|
||||
@@ -361,7 +361,7 @@ class IronicImagesTestCase(base.TestCase):
|
||||
images.image_to_raw('image_href', 'path', 'path_tmp')
|
||||
info.safety_check.assert_not_called()
|
||||
detect_format_mock.assert_has_calls([
|
||||
mock.call('path')])
|
||||
mock.call('path_tmp')])
|
||||
self.assertEqual(2, info.__str__.call_count)
|
||||
convert_image_mock.assert_called_once_with('path_tmp',
|
||||
'path.converted', 'raw',
|
||||
@@ -390,7 +390,7 @@ class IronicImagesTestCase(base.TestCase):
|
||||
info.safety_check.assert_not_called()
|
||||
self.assertEqual(2, info.__str__.call_count)
|
||||
detect_format_mock.assert_has_calls([
|
||||
mock.call('path')])
|
||||
mock.call('path_tmp')])
|
||||
convert_image_mock.assert_called_once_with('path_tmp',
|
||||
'path.converted', 'raw',
|
||||
source_format='vmdk')
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
When disable_deep_image_inspection = true, the code path uses the destination
|
||||
filename as the source file name resulting in a failure. Due to the way the
|
||||
code attempts to clean up, this error is swallowed and only caught later on
|
||||
when the file is used.
|
||||
Reference in New Issue
Block a user