From f8fd5fa519ee82ce3d6e60a92184cd95327478c4 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Thu, 12 Feb 2015 16:58:48 -0800 Subject: [PATCH] Corrects the rescue clause --- lib/googleauth/compute_engine.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/googleauth/compute_engine.rb b/lib/googleauth/compute_engine.rb index c99214b..b820af1 100644 --- a/lib/googleauth/compute_engine.rb +++ b/lib/googleauth/compute_engine.rb @@ -46,6 +46,7 @@ module Google class << self extend Memoist + # Detect if this appear to be a GCE instance, by checking if metadata # is available def on_gce?(options = {}) @@ -64,9 +65,10 @@ module Google return false unless resp.status == 200 return false unless resp.headers.key?('Metadata-Flavor') return resp.headers['Metadata-Flavor'] == 'Google' - rescue [Faraday::TimeoutError, Faraday::ConnectionFailed] + rescue Faraday::TimeoutError, Faraday::ConnectionFailed return false end + memoize :on_gce? end