Corrects the rescue clause

This commit is contained in:
Tim Emiola 2015-02-12 16:58:48 -08:00
parent 1492408997
commit f8fd5fa519
1 changed files with 3 additions and 1 deletions

View File

@ -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