Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit d555826

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Don't reuse 'body' for response data"
2 parents 298a0e5 + 3d61487 commit d555826

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

neutronclient/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,22 +234,22 @@ def authenticate(self):
234234
tmp_follow_all_redirects = self.follow_all_redirects
235235
self.follow_all_redirects = True
236236
try:
237-
resp, body = self._cs_request(token_url, "POST",
238-
body=json.dumps(body),
239-
content_type="application/json")
237+
resp, resp_body = self._cs_request(token_url, "POST",
238+
body=json.dumps(body),
239+
content_type="application/json")
240240
finally:
241241
self.follow_all_redirects = tmp_follow_all_redirects
242242
status_code = self.get_status_code(resp)
243243
if status_code != 200:
244-
raise exceptions.Unauthorized(message=body)
245-
if body:
244+
raise exceptions.Unauthorized(message=resp_body)
245+
if resp_body:
246246
try:
247-
body = json.loads(body)
247+
resp_body = json.loads(resp_body)
248248
except ValueError:
249249
pass
250250
else:
251-
body = None
252-
self._extract_service_catalog(body)
251+
resp_body = None
252+
self._extract_service_catalog(resp_body)
253253

254254
def _get_endpoint_url(self):
255255
url = self.auth_url + '/tokens/%s/endpoints' % self.auth_token

0 commit comments

Comments
 (0)