Hide Forgot
Description of problem: Customer met following error. - `openstack image add project` fails with AttributeError for image v2 https://bugs.launchpad.net/python-openstackclient/+bug/1509054 - Change If6e7c4bd: Fix issue when displaying image_member | review.openstack Code Review https://review.openstack.org/#/c/238733/ https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=12668b3dababed103c3ad74fee4b7e81d4be1de3 ~~~ Fix issue when displaying image_member image_member doesn't have a _info attribute, glanceclient returns warlock object instead of a Resource object. Change-Id: If6e7c4bd404454bd6cbe8c111879c1afa1380211 Closes-Bug: #1509054 ~~~ Version-Release number of selected component (if applicable): Red Hat OpenStack Platform 8 How reproducible: Always Steps to Reproduce: 1. $ openstack image add project <Image ID> <Proejct ID> 2. 3. Actual results: Trackback. Expected results: Glanceclient returns warlock object instead of a Resource object. Additional info: I could reproduce similar error which customer saw, as follows: + openstack --debug image add project 70e87eec-eb37-45fc-9b81-b1d36ceb2928 ea8c5061423540b2b7e99c77d4041202 ... curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'User-Agent: python-glanceclient' -H 'Connection: keep-alive' -H 'X-Auth-Token: {SHA1}87eda890f8d5b9995a04be20bad8ed2ba5f8e920' -H 'Content-Type: application/octet-stream' http://192.168.123.101:9292/v2/schemas/member "GET /v2/schemas/member HTTP/1.1" 200 660 HTTP/1.1 200 OK date: Mon, 28 Nov 2016 07:59:01 GMT connection: keep-alive content-type: application/json; charset=UTF-8 content-length: 660 x-openstack-request-id: req-ebb97bd4-c4e6-4a85-9b77-3d4569184d01 {"name": "member", "properties": {"status": {"enum": ["pending", "accepted", "rejected"], "type": "string", "description": "The status of this image member"}, "created_at": {"type": "string", "description": "Date and time of image member creation"}, "updated_at": {"type": "string", "description": "Date and time of last modification of image member"}, "image_id": {"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", "type": "string", "description": "An identifier for the image"}, "member_id": {"type": "string", "description": "An identifier for the image member (tenantId)"}, "schema": {"type": "string"}}} _info Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cliff/app.py", line 374, in run_subcommand result = cmd.run(parsed_args) File "/usr/lib/python2.7/site-packages/cliff/display.py", line 92, in run column_names, data = self.take_action(parsed_args) File "/usr/lib/python2.7/site-packages/openstackclient/image/v2/image.py", line 109, in take_action return zip(*sorted(six.iteritems(image_member._info))) File "/usr/lib/python2.7/site-packages/warlock/model.py", line 69, in __getattr__ raise AttributeError(key) AttributeError: _info clean_up AddProjectToImage: _info Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/openstackclient/shell.py", line 112, in run ret_val = super(OpenStackShell, self).run(argv) File "/usr/lib/python2.7/site-packages/cliff/app.py", line 255, in run result = self.run_subcommand(remainder) File "/usr/lib/python2.7/site-packages/cliff/app.py", line 374, in run_subcommand result = cmd.run(parsed_args) File "/usr/lib/python2.7/site-packages/cliff/display.py", line 92, in run column_names, data = self.take_action(parsed_args) File "/usr/lib/python2.7/site-packages/openstackclient/image/v2/image.py", line 109, in take_action return zip(*sorted(six.iteritems(image_member._info))) File "/usr/lib/python2.7/site-packages/warlock/model.py", line 69, in __getattr__ raise AttributeError(key) AttributeError: _info END return value: 1 + exit Patch: --- /usr/lib/python2.7/site-packages/openstackclient/image/v2/image.py-2016-11-28 2016-11-28 17:03:28.084646006 +0900 +++ /usr/lib/python2.7/site-packages/openstackclient/image/v2/image.py 2016-11-28 17:03:49.652772804 +0900 @@ -106,7 +106,7 @@ project_id, ) - return zip(*sorted(six.iteritems(image_member._info))) + return zip(*sorted(six.iteritems(image_member))) class CreateImage(show.ShowOne): Result with patch: + openstack --debug image add project 21310515-f885-4077-b823-3864d02b82bc ea8c5061423540b2b7e99c77d4041202 ... curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'User-Agent: python-glanceclient' -H 'Connection: keep-alive' -H 'X-Auth-Token: {SHA1}6f4292bde4433d6d5ea97a8abf16cf8649b78e03' -H 'Content-Type: application/octet-stream' http://192.168.123.101:9292/v2/schemas/member "GET /v2/schemas/member HTTP/1.1" 200 660 HTTP/1.1 200 OK date: Mon, 28 Nov 2016 08:04:02 GMT connection: keep-alive content-type: application/json; charset=UTF-8 content-length: 660 x-openstack-request-id: req-a9da4a64-71d7-408c-a3f4-6e9b3a870a88 {"name": "member", "properties": {"status": {"enum": ["pending", "accepted", "rejected"], "type": "string", "description": "The status of this image member"}, "created_at": {"type": "string", "description": "Date and time of image member creation"}, "updated_at": {"type": "string", "description": "Date and time of last modification of image member"}, "image_id": {"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", "type": "string", "description": "An identifier for the image"}, "member_id": {"type": "string", "description": "An identifier for the image member (tenantId)"}, "schema": {"type": "string"}}} +------------+--------------------------------------+ | Field | Value | +------------+--------------------------------------+ | created_at | 2016-11-28T08:04:02Z | | image_id | 21310515-f885-4077-b823-3864d02b82bc | | member_id | ea8c5061423540b2b7e99c77d4041202 | | schema | /v2/schemas/member | | status | pending | | updated_at | 2016-11-28T08:04:02Z | +------------+--------------------------------------+ clean_up AddProjectToImage: END return value: 0 + exit
Adjusting flags since this is a backport request. The linked upstream bug indicates the fix was released in 1.9.0 [1] which is Mitaka / OSP9. [1] https://bugs.launchpad.net/python-openstackclient/+bug/1509054 [2] https://releases.openstack.org/teams/openstackclient.html#team-mitaka-python-openstackclient