aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-09-03 11:05:27 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-09-03 11:05:27 +0000
commit8f71d7ed87007ace129f647b242a09d01773d3c5 (patch)
tree2c46ca9d89eb0ce5eea79ba1febb79e56efedb0f /contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
parent78242bd5894abd6548e45731b464822da55a0796 (diff)
parent3da5a68ec3c329240e89bd0ed8c1c39e4359a693 (diff)
downloadydb-8f71d7ed87007ace129f647b242a09d01773d3c5.tar.gz
Merge branch 'rightlib' into mergelibs-240903-1104
Diffstat (limited to 'contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py')
-rw-r--r--contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
index 69b7b52458..b66d9f9b37 100644
--- a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
+++ b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py
@@ -28,6 +28,7 @@ from google.auth import _helpers
from google.auth import environment_vars
from google.auth import exceptions
from google.auth import metrics
+from google.auth import transport
from google.auth._exponential_backoff import ExponentialBackoff
_LOGGER = logging.getLogger(__name__)
@@ -204,7 +205,17 @@ def get(
for attempt in backoff:
try:
response = request(url=url, method="GET", headers=headers_to_use)
- break
+ if response.status in transport.DEFAULT_RETRYABLE_STATUS_CODES:
+ _LOGGER.warning(
+ "Compute Engine Metadata server unavailable on "
+ "attempt %s of %s. Response status: %s",
+ attempt,
+ retry_count,
+ response.status,
+ )
+ continue
+ else:
+ break
except exceptions.TransportError as e:
_LOGGER.warning(