Bug 2165616 - imageutils: calling str on a QemuImgInfo instance raises AttributeError
Summary: imageutils: calling str on a QemuImgInfo instance raises AttributeError
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-oslo-utils
Version: 17.1 (Wallaby)
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: 17.1
Assignee: Hervé Beraud
QA Contact: dabarzil
URL:
Whiteboard:
Depends On:
Blocks: 2165620
TreeView+ depends on / blocked
 
Reported: 2023-01-30 15:06 UTC by Hervé Beraud
Modified: 2023-08-16 01:14 UTC (History)
4 users (show)

Fixed In Version: python-oslo-utils-4.8.2-1.20230201111008.a38b56a.el9ost
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2165620 (view as bug list)
Environment:
Last Closed: 2023-08-16 01:13:42 UTC
Target Upstream Version:
Embargoed:
hberaud: needinfo-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker OSP-21891 0 None None None 2023-01-30 15:09:15 UTC
Red Hat Product Errata RHEA-2023:4577 0 None None None 2023-08-16 01:14:10 UTC

Description Hervé Beraud 2023-01-30 15:06:43 UTC
Description of problem:

When a QemuImgInfo object contains a format_specific value, calling
str() on it raises "AttributeError: 'list' object has no attribute 'appened'"




Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
Python 3.9.14 (main, Oct 4 2022, 17:06:42)
>>> from oslo_utils import imageutils
>>> fake_data = imageutils.QemuImgInfo()
>>> fake_data.type = 'vmdk'
>>> fake_data.format_specific = {'type': 'vmdk', 'data': {}}
>>> fake_data.format_specific['data']['create-type'] = 'monolithicSparse'
>>> str(fake_data)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".tox/py39/lib/python3.9/site-packages/oslo_utils/imageutils.py", line 103, in __str__
    lines.appened("format_specific: %s" % self.format_specific)
AttributeError: 'list' object has no attribute 'appened'
>>>

Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".tox/py39/lib/python3.9/site-packages/oslo_utils/imageutils.py", line 103, in __str__
    lines.appened("format_specific: %s" % self.format_specific)
AttributeError: 'list' object has no attribute 'appened'

Expected results:
No attributeError

Additional info:
A fix exist upstream and should be cherry-picked to OSP17.x https://opendev.org/openstack/oslo.utils/commit/d49d5944824f15d00e04e1b9c7f8c3b03b440c95

Comment 1 Hervé Beraud 2023-02-01 12:34:36 UTC
Fixed in version python-oslo-utils-4.8.2-1.20230201104135.a38b56a.el8osttrunk

https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=2355193

Comment 5 dabarzil 2023-03-07 11:11:06 UTC
Verified:
Python 3.9.16 (main, Dec  8 2022, 00:00:00) 
[GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from oslo_utils import imageutils
>>> fake_data = imageutils.QemuImgInfo()
>>> fake_data.type = 'vmdk'
>>> fake_data.format_specific = {'type': 'vmdk', 'data': {}}
>>> fake_data.format_specific['data']['create-type'] = 'monolithicSparse'
>>> str(fake_data)
"image: None\nfile_format: None\nvirtual_size: None\ndisk_size: None\ncluster_size: None\nbacking_file: None\nformat_specific: {'type': 'vmdk', 'data': {'create-type': 'monolithicSparse'}}"
>>>

Comment 15 errata-xmlrpc 2023-08-16 01:13:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 17.1 (Wallaby)), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2023:4577


Note You need to log in before you can comment on or make changes to this bug.