Unhandled AttributeArrors when Content-Type header not set in response
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-magnumclient |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
If the HTTP response from magnum API does not set the Content-Type header then magnum client raises unhandled AttributeError.
This makes it difficult to handle errors gracefully in horizon (magnum UI) which will either throw a 500 if the error is not caught - or is otherwise difficult to provided a more meaningfull erorr message for the client.
AttributeError: HTTPResponse instance has no attribute 'headers'
2020-04-01 04:18:27,644 28809 ERROR openstack_
Traceback (most recent call last):
File "/opt/cat/
data = function(self, request, *args, **kw)
File "/opt/cat/
new_cluster = magnum.
File "/opt/cat/
return magnumclient(
File "/opt/cat/
return self._create(
File "/opt/cat/
resp, body = self.api.
File "/opt/cat/
resp, body_iter = self._http_
File "/opt/cat/
error_json = _extract_
File "/opt/cat/
content_type = resp.headers.
AttributeError: HTTPResponse instance has no attribute 'headers'
2020-04-01 04:18:41,282 28814 WARNING django.request Not Found: /api/container_
Changed in python-magnumclient: | |
status: | New → Fix Committed |
Changed in python-magnumclient: | |
status: | Fix Committed → Fix Released |
I'm happy to submit a patch to fix this, but I raised it here to track it none the less