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

Adds a new -disable-host-node-id option to help when testing with containers. #2904

Merged
merged 1 commit into from
Apr 13, 2017

Conversation

slackpad
Copy link
Contributor

Fixes #2877.

@@ -1371,6 +1376,9 @@ func MergeConfig(a, b *Config) *Config {
if b.NodeID != "" {
result.NodeID = b.NodeID
}
if b.DisableHostNodeID == true {
result.DisableHostNodeID = b.DisableHostNodeID
Copy link
Contributor

Choose a reason for hiding this comment

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

Can simplify as: result.DisableHostNodeID = b.DisableHostNodeID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately that'll let a merge with the default value of false overwrite a previous value of true. In other words, we use the fact that it's true to indicate that the user actively set it. We could use a *bool here, but this way works as well since this defaults to false.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah great point! Thank you for that explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Been working on a little framework to do everything with pointers so we can always tell if the user set it and merge cleanly, but haven't got everything ported to that yet - https://github.com/hashicorp/consul/blob/master/command/base/config_util.go.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nice I will check it out. Is the framework done and just needs to be integrated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's close - probably needs some support for a few other data types that show up in the config options.

@slackpad slackpad merged commit 2843da5 into master Apr 13, 2017
@slackpad slackpad deleted the non-host-id branch April 13, 2017 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants