Comments (1)
The issue is that the top-level object never changes because of the trailing ?recursive=true
The calls will be:
/computeMetadata/v1/?recursive=true/
/computeMetadata/v1/?recursive=true/instance/
/computeMetadata/v1/?recursive=true/instance/instance/
and so on
diff --git lib/ohai/mixin/gce_metadata.rb lib/ohai/mixin/gce_metadata.rb
index 64b35f92..29725c3b 100644
--- lib/ohai/mixin/gce_metadata.rb
+++ lib/ohai/mixin/gce_metadata.rb
@@ -23,7 +23,7 @@ module Ohai
# Trailing dot to host is added to avoid DNS search path
GCE_METADATA_ADDR ||= "metadata.google.internal."
- GCE_METADATA_URL ||= "/computeMetadata/v1/?recursive=true"
+ GCE_METADATA_URL ||= "/computeMetadata/v1"
# fetch the meta content with a timeout and the required header
def http_get(uri)
@@ -36,7 +36,9 @@ module Ohai
end
def fetch_metadata(id = "")
- response = http_get("#{GCE_METADATA_URL}/#{id}")
+ url = "#{GCE_METADATA_URL}/#{id}"
+ url << "?recursive=true" if url.end_with?("/")
+ response = http_get(url)
return nil unless response.code == "200"
if json?(response.body)
from ohai.
Related Issues (20)
- Darwin Hardware: Imparity between Intel and ARM/M1 (Apple Silicon) Apple devices HOT 3
- Ohai simultaneously detects EC2 and Azure clouds
- fips plugin does not detect host fips mode properly HOT 4
- CPU total is 0 when threads-per-core is 0 HOT 1
- lscpu parser doesn't parse Raspberry Pi 4 (ARM Cortex-A72) output HOT 4
- Custom Ohai plugin not functioning properly after Chef 17 upgrade.
- Metadata tags with spaces cause ohai ec2 to return an empty response
- Network Plugin intermittently unable to detect ipaddress
- fetching metadata on VMs with pre-defined user-data of Alibaba Cloud causing a never-end recursion, maybe other Cloud Service Providers are affected too HOT 1
- node['cloud'] = nil in AWS environment where full tunnel VPN is enabled
- Installation of version 17.9.0 fails with unavailable dependency HOT 5
- [BUG] Ohai passwd - segmentation fault at 0x0000000000000000 HOT 1
- Darwin virtualization plugin: potential for false positive HOT 2
- cloud plugin fail on Oracle Cloud Infrastructure (OCI) HOT 1
- Another instance of possible incorrect class comparison
- Incorrect/truncated CPU flags returned with later Linux kernels
- [17.9.0] EC2 metadata missing `network-card` information
- lscpu on Debian VM on ARM system crashes CPU plugin HOT 1
- rubygems is showing ohai 18.1.3 as the latest version (from March 08, 2023
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ohai.