File tree 1 file changed +12
-1
lines changed
google/auth/compute_engine
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 28
28
from google .auth import environment_vars
29
29
from google .auth import exceptions
30
30
from google .auth import metrics
31
+ from google .auth import transport
31
32
from google .auth ._exponential_backoff import ExponentialBackoff
32
33
33
34
_LOGGER = logging .getLogger (__name__ )
@@ -204,7 +205,17 @@ def get(
204
205
for attempt in backoff :
205
206
try :
206
207
response = request (url = url , method = "GET" , headers = headers_to_use )
207
- break
208
+ if response .status in transport .DEFAULT_RETRYABLE_STATUS_CODES :
209
+ _LOGGER .warning (
210
+ "Compute Engine Metadata server unavailable on "
211
+ "attempt %s of %s. Response status: %s" ,
212
+ attempt ,
213
+ retry_count ,
214
+ response .status ,
215
+ )
216
+ continue
217
+ else :
218
+ break
208
219
209
220
except exceptions .TransportError as e :
210
221
_LOGGER .warning (
You can’t perform that action at this time.
0 commit comments