[imageutils] Fix __str__ for QemuImgInfo

Code is calling 'appened' on a list; correct this to 'append'.

Closes-bug: #1996426
Change-Id: I8729cf180f92f43519c942e22f3b285377a5612f
This commit is contained in:
Brian Rosmaita 2022-11-11 16:14:47 -05:00
parent cb8076bbe4
commit d49d594482
2 changed files with 4 additions and 1 deletions

View File

@ -100,7 +100,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):

View File

@ -264,6 +264,9 @@ class ImageUtilsJSONTestCase(test_base.BaseTestCase):
self.assertEqual(13168640, image_info.disk_size)
self.assertEqual("bar", image_info.format_specific["data"]["foo"])
self.assertEqual('yes', image_info.encrypted)
# test for Bug #1996426
expected_str = "format_specific: {'data': {'foo': 'bar'}}"
self.assertIn(expected_str, str(image_info))
@mock.patch("debtcollector.deprecate")
def test_qemu_img_info_blank(self, mock_deprecate):