Browse Source

Fix failing to parse json error msg

It assumes its a requests response but could
be a HTTPResponse from urllib.

Story: 2008789
Task: 42183

Change-Id: I7306d167a17284c7f478ec1c1599a8d4b32040c2
(cherry picked from commit f7551a6bac103070ff456098fe2631409620d492)
(cherry picked from commit 280acd2dff27d49d7606877edc3f17482f7444f6)
changes/03/785603/1 3.2.2
Tobias Urdin 7 months ago
parent
commit
fc941022c5
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      magnumclient/common/httpclient.py

+ 3
- 0
magnumclient/common/httpclient.py View File

@ -69,6 +69,9 @@ def _extract_error_json(body, resp):
try:
body_json = resp.json()
return _extract_error_json_text(body_json)
except AttributeError:
body_json = jsonutils.loads(body)
return _extract_error_json_text(body_json)
except ValueError:
return {}
else:


Loading…
Cancel
Save