Avoid memoizing network-related false negatives of GCECredentials.on_gce? (#137)

This commit is contained in:
Kazuhiro Serizawa 2018-06-06 07:20:36 +09:00 committed by Daniel Azuma
parent 9232aa3176
commit edaa784d3d
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ ERROR_MESSAGE
DefaultCredentials.from_well_known_path(scope) || DefaultCredentials.from_well_known_path(scope) ||
DefaultCredentials.from_system_default_path(scope) DefaultCredentials.from_system_default_path(scope)
return creds unless creds.nil? return creds unless creds.nil?
raise NOT_FOUND_ERROR unless GCECredentials.on_gce?(options) unless GCECredentials.on_gce?(options)
# Clear cache of the result of GCECredentials.on_gce?
GCECredentials.unmemoize_all
raise NOT_FOUND_ERROR
end
GCECredentials.new GCECredentials.new
end end