diff options
author | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2022-11-11 16:14:47 -0500 |
---|---|---|
committer | Hervé Beraud <herveberaud.pro@gmail.com> | 2023-01-30 09:50:29 +0000 |
commit | 3ae82df28d7882dc4d13e9332b273a1b42fa82ce (patch) | |
tree | e5a42b7d823b6174ffd5c594e073efeafcec2ba4 | |
parent | 90a504672071d61bdae3206c4764bd3528c165d6 (diff) | |
download | oslo-utils-stable/xena.tar.gz |
[imageutils] Fix __str__ for QemuImgInfostable/xena
Code is calling 'appened' on a list; correct this to 'append'.
Closes-bug: #1996426
Change-Id: I8729cf180f92f43519c942e22f3b285377a5612f
(cherry picked from commit d49d5944824f15d00e04e1b9c7f8c3b03b440c95)
-rw-r--r-- | oslo_utils/imageutils.py | 2 | ||||
-rw-r--r-- | oslo_utils/tests/test_imageutils.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/oslo_utils/imageutils.py b/oslo_utils/imageutils.py index d764a7f..3e10526 100644 --- a/oslo_utils/imageutils.py +++ b/oslo_utils/imageutils.py @@ -97,7 +97,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 6b25226..ff25dcc 100644 --- a/oslo_utils/tests/test_imageutils.py +++ b/oslo_utils/tests/test_imageutils.py @@ -250,6 +250,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): |