summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Rosmaita <rosmaita.fossdev@gmail.com>2022-11-11 16:14:47 -0500
committerHervé Beraud <hberaud@redhat.com>2023-01-30 17:45:52 +0100
commitfe0d22524021c86ba82c156cc08b1a1890effc60 (patch)
tree4c7d83e0f9859892d95d06e81afcfc65c6f4db22
parenta38b56a6f9438d256d6e0f9b03181015f2b27d8c (diff)
downloadoslo-utils-stable/wallaby.tar.gz
[imageutils] Fix __str__ for QemuImgInfostable/wallaby
Code is calling 'appened' on a list; correct this to 'append'. Conflicts: Fix conflict in test_imageutils with adding an assertion due to ignored backport https://opendev.org/openstack/oslo.utils/commit/2922a3491a5987aa80f0612df44bd60ed22a0225 Closes-bug: #1996426 Change-Id: I8729cf180f92f43519c942e22f3b285377a5612f (cherry picked from commit d49d5944824f15d00e04e1b9c7f8c3b03b440c95)
-rw-r--r--oslo_utils/imageutils.py2
-rw-r--r--oslo_utils/tests/test_imageutils.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/oslo_utils/imageutils.py b/oslo_utils/imageutils.py
index fc7b494..ca52cd1 100644
--- a/oslo_utils/imageutils.py
+++ b/oslo_utils/imageutils.py
@@ -86,7 +86,7 @@ class QemuImgInfo(object):
if self.encrypted:
lines.append("encrypted: %s" % self.encrypted)
if self.format_specific:
- lines.appened("format_specific: %s" % self.format_specific)
+ lines.append("format_specific: %s" % self.format_specific)
return "\n".join(lines)
def _canonicalize(self, field):
diff --git a/oslo_utils/tests/test_imageutils.py b/oslo_utils/tests/test_imageutils.py
index 6b3a9fa..f92b79b 100644
--- a/oslo_utils/tests/test_imageutils.py
+++ b/oslo_utils/tests/test_imageutils.py
@@ -236,6 +236,9 @@ class ImageUtilsJSONTestCase(test_base.BaseTestCase):
self.assertEqual('qcow2', image_info.file_format)
self.assertEqual(13168640, image_info.disk_size)
self.assertEqual("bar", image_info.format_specific["data"]["foo"])
+ # test for Bug #1996426
+ expected_str = "format_specific: {'data': {'foo': 'bar'}}"
+ self.assertIn(expected_str, str(image_info))
def test_qemu_img_info_json_format_blank(self):
img_output = '{}'