-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle non 200 codes while getting env metadata #614
Conversation
@@ -116,6 +116,9 @@ func (f *EnvAWSFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) | |||
} | |||
for _, k := range keys { | |||
res, err := client.Get(metadataURL + k) | |||
if res.StatusCode != 200 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably log something here with WARN
, just so people can see why some of AWS metadata is not showing up upon nomad node-status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@achanda Another small nitpick, can we do res.StatusCode != http. StatusOK
instead of 200?
@@ -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 !=200 { | |||
f.logger.Printf("[WARN]: fingerprint.env_gce: Could not read value for attribute %s", k) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like k
is not defined here.
Handle non 200 codes while getting env metadata
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Not 100% sure what the behavior should be here. Please comment.
cc @c4milo