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

Fix TLS use in AllocFS API and region/dc detection #2490

Merged
merged 2 commits into from
Mar 28, 2017
Merged

Conversation

schmichael
Copy link
Member

@schmichael schmichael commented Mar 28, 2017

Fixes #2290

api/agent.go Outdated
@@ -60,10 +60,10 @@ func (a *Agent) populateCache(self *AgentSelf) {
a.nodeName = self.Member.Name
}
if a.datacenter == "" {
a.datacenter, _ = self.Member.Tags["dc"]
a.datacenter, _ = self.Config["Datacenter"].(string)
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 feel more comfortable if we validate the value existed to avoid panics

Copy link
Member Author

@schmichael schmichael Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this code is panic-safe, but it's overly clever so I'll fix it :)

(The 2 form assignment applies to the type assertion, so if the key doesn't exist it returns interface{}(nil) which when 2-form-assignment-asserted to string gives you the empty string which datacenter is anyway! Way too "clever" https://play.golang.org/p/5jcXxfdthi )

@dadgar
Copy link
Contributor

dadgar commented Mar 28, 2017

Would mark the issue this fixes. LGTM

@schmichael schmichael merged commit fe98392 into master Mar 28, 2017
@schmichael schmichael deleted the b-fix-api-tls branch March 28, 2017 16:40
schmichael added a commit that referenced this pull request Mar 28, 2017
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

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 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants