lib/google/cloud/env.rb in google-cloud-env-1.2.0 vs lib/google/cloud/env.rb in google-cloud-env-1.2.1
- old
+ new
@@ -354,10 +354,12 @@
#
def metadata?
path = METADATA_ROOT_PATH
if @disable_metadata_cache || !metadata_cache.include?(path)
metadata_cache[path] = retry_or_fail_with false do
- resp = connection.get path
+ resp = connection.get path do |req|
+ req.headers = { "Metadata-Flavor" => "Google" }
+ end
resp.status == 200 && resp.headers["Metadata-Flavor"] == "Google"
end
end
metadata_cache[path]
end