Skip to content

Commit

Permalink
fix: fix the message format for metadata server exception (#916)
Browse files Browse the repository at this point in the history
```
RefreshError: ("Failed to ... from the Google Compute Enginemetadata service. Status: 403 ...)
```
  • Loading branch information
haoxins authored Nov 10, 2021
1 parent 3a01950 commit e756f08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions google/auth/compute_engine/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def get(
retries += 1
else:
raise exceptions.TransportError(
"Failed to retrieve {} from the Google Compute Engine"
"Failed to retrieve {} from the Google Compute Engine "
"metadata service. Compute Engine Metadata server unavailable".format(url)
)

Expand All @@ -172,15 +172,15 @@ def get(
return json.loads(content)
except ValueError as caught_exc:
new_exc = exceptions.TransportError(
"Received invalid JSON from the Google Compute Engine"
"Received invalid JSON from the Google Compute Engine "
"metadata service: {:.20}".format(content)
)
six.raise_from(new_exc, caught_exc)
else:
return content
else:
raise exceptions.TransportError(
"Failed to retrieve {} from the Google Compute Engine"
"Failed to retrieve {} from the Google Compute Engine "
"metadata service. Status: {} Response:\n{}".format(
url, response.status, response.data
),
Expand Down

0 comments on commit e756f08

Please sign in to comment.