diff --git a/client/fingerprint/env_aws.go b/client/fingerprint/env_aws.go index 1963f6c50af..3a55aff50d3 100644 --- a/client/fingerprint/env_aws.go +++ b/client/fingerprint/env_aws.go @@ -116,6 +116,10 @@ func (f *EnvAWSFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) } for _, k := range keys { res, err := client.Get(metadataURL + k) + if res.StatusCode != http.StatusOK { + f.logger.Printf("[WARN]: fingerprint.env_aws: Could not read value for attribute %q", k) + continue + } if err != nil { // if it's a URL error, assume we're not in an AWS environment // TODO: better way to detect AWS? Check xen virtualization? diff --git a/client/fingerprint/env_gce.go b/client/fingerprint/env_gce.go index 357148c5fee..0353dbdb1e9 100644 --- a/client/fingerprint/env_gce.go +++ b/client/fingerprint/env_gce.go @@ -94,7 +94,8 @@ func (f *EnvGCEFingerprint) Get(attribute string, recursive bool) (string, error } res, err := f.client.Do(req) - if err != nil { + if err != nil || res.StatusCode != http.StatusOK { + f.logger.Printf("[WARN]: fingerprint.env_gce: Could not read value for attribute %q", attribute) return "", err }