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 consul stanza parsing when a configuration directory is used #5817

Merged
merged 5 commits into from
Jun 11, 2019

Conversation

langmartin
Copy link
Contributor

When parsing a configuration directory, consul, vault, and autopilot stanzas are parsed correctly only if they are in the last file loaded. This change restores correct default merging behavior.

@langmartin
Copy link
Contributor Author

Fixes #5795 and #5816

@@ -14,6 +14,15 @@ import (
"github.com/hashicorp/nomad/nomad/structs/config"
)

// ParseConfigDefault returns the configuration base
func ParseConfigDefault() *Config {
return &Config{
Copy link
Contributor

@preetapan preetapan Jun 11, 2019

Choose a reason for hiding this comment

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

Are there more than just these three that need to have defaults set correctly?
Would be good to add a comment clarifying when new fields with defaults should be added to this return struct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the only three where the defaults are required before decoding, other defaults are set in command.readConfig

Copy link
Contributor

@preetapan preetapan left a comment

Choose a reason for hiding this comment

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

One clarifying question, otherwise lgtm

Copy link
Contributor

@notnoop notnoop left a comment

Choose a reason for hiding this comment

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

lgtm - I'd do some manual testing too.

The use of public functions here is odd, e.g. ParseConfigDefault doesn't need to be public, but neither does most parsing functions there I think.

if err != nil {
return nil, err
}
return defaults.Merge(config), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: I would consider moving this logic into LoadConfigDir.

@github-actions
Copy link

github-actions bot commented Feb 8, 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 Feb 8, 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.

3 participants