Skip to content
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

Merged
merged 1 commit into from
Dec 22, 2015
Merged

Handle non 200 codes while getting env metadata #614

merged 1 commit into from
Dec 22, 2015

Conversation

achanda
Copy link
Contributor

@achanda achanda commented Dec 21, 2015

Not 100% sure what the behavior should be here. Please comment.
cc @c4milo

@@ -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 {
Copy link
Contributor

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

Copy link
Contributor

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)
Copy link
Contributor

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.

dadgar added a commit that referenced this pull request Dec 22, 2015
Handle non 200 codes while getting env metadata
@dadgar dadgar merged commit 50e2fbd into hashicorp:master Dec 22, 2015
@achanda achanda deleted the handle_status branch December 22, 2015 18:13
@github-actions
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants