From edaa784d3de1f35fc6bc7de31302858a1e7b78c5 Mon Sep 17 00:00:00 2001 From: Kazuhiro Serizawa Date: Wed, 6 Jun 2018 07:20:36 +0900 Subject: [PATCH] Avoid memoizing network-related false negatives of GCECredentials.on_gce? (#137) --- lib/googleauth/application_default.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/googleauth/application_default.rb b/lib/googleauth/application_default.rb index ec8b909..82a8895 100644 --- a/lib/googleauth/application_default.rb +++ b/lib/googleauth/application_default.rb @@ -58,7 +58,11 @@ ERROR_MESSAGE DefaultCredentials.from_well_known_path(scope) || DefaultCredentials.from_system_default_path(scope) 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 end