Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Show the transport exception that happened for GCE Metadata #474

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions google/auth/compute_engine/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ def ping(request, timeout=_METADATA_DEFAULT_TIMEOUT, retry_count=3):
and metadata_flavor == _METADATA_FLAVOR_VALUE
)

except exceptions.TransportError:
_LOGGER.info(
"Compute Engine Metadata server unavailable on" "attempt %s of %s",
except exceptions.TransportError as e:
_LOGGER.warning(
"Compute Engine Metadata server unavailable on"
"attempt %s of %s. Reason: %s",
retries + 1,
retry_count,
e,
)
retries += 1

Expand Down Expand Up @@ -144,11 +146,13 @@ def get(request, path, root=_METADATA_ROOT, recursive=False, retry_count=5):
response = request(url=url, method="GET", headers=_METADATA_HEADERS)
break

except exceptions.TransportError:
_LOGGER.info(
"Compute Engine Metadata server unavailable on" "attempt %s of %s",
except exceptions.TransportError as e:
_LOGGER.warning(
"Compute Engine Metadata server unavailable on"
"attempt %s of %s. Reason: %s",
retries + 1,
retry_count,
e,
)
retries += 1
else:
Expand Down