KeyError happens when response body dosen't contain the key

Bug #1480741 reported by Haiwei Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack SDK
Fix Committed
Undecided
Haiwei Xu

Bug Description

Sometimes the exception returned from server does not contain a resource key, for example HTTPAccepted(202) just returns a notice, which should not be treated as an exception.

But in openstack/resource.py, it is believed that the response body contains resource_key, which will cause a KeyError.

708 @classmethod
709 def update_by_id(cls, session, resource_id, attrs, path_args=None):
710 """Update a remote resource with the given attributes.
......
748
749 if cls.resource_key:
750 resp = resp[cls.resource_key]
751
752 return resp

Haiwei Xu (xu-haiwei)
Changed in python-openstacksdk:
assignee: nobody → Haiwei Xu (xu-haiwei)
Revision history for this message
Haiwei Xu (xu-haiwei) wrote :

Fix committed in this patch https://review.openstack.org/#/c/208265/

Changed in python-openstacksdk:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.