Corrects the rescue clause
This commit is contained in:
parent
1492408997
commit
f8fd5fa519
|
@ -46,6 +46,7 @@ module Google
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
extend Memoist
|
extend Memoist
|
||||||
|
|
||||||
# Detect if this appear to be a GCE instance, by checking if metadata
|
# Detect if this appear to be a GCE instance, by checking if metadata
|
||||||
# is available
|
# is available
|
||||||
def on_gce?(options = {})
|
def on_gce?(options = {})
|
||||||
|
@ -64,9 +65,10 @@ module Google
|
||||||
return false unless resp.status == 200
|
return false unless resp.status == 200
|
||||||
return false unless resp.headers.key?('Metadata-Flavor')
|
return false unless resp.headers.key?('Metadata-Flavor')
|
||||||
return resp.headers['Metadata-Flavor'] == 'Google'
|
return resp.headers['Metadata-Flavor'] == 'Google'
|
||||||
rescue [Faraday::TimeoutError, Faraday::ConnectionFailed]
|
rescue Faraday::TimeoutError, Faraday::ConnectionFailed
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
memoize :on_gce?
|
memoize :on_gce?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue