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

Agent configuration cleanup #1074

Merged
merged 1 commit into from
Feb 26, 2018

Conversation

mcorbin
Copy link
Contributor

@mcorbin mcorbin commented Feb 25, 2018

Signed-off-by: mcorbin corbin.math@gmail.com

What is this change?

I tried to fix #392. the goal was to have the agent default configuration in one place.
I created some const variables for the agent default configuration, and used them in start.go. I also created a new FixtureConfig function for tests.

Why is this change necessary?

The agent default configuration was in two distinct places, in the NewConfig function in sensu-go/agent/agent.go and in the CLI default in sensu-go/agent/cmd/start.go.

Does your change need a Changelog entry?

I added one.

Do you need clarification on anything?

I'm not sure about the default flagCacheDir value. It's path.SystemCacheDir("sensu-agent") (so /var/cache/sensu/sensu-agent) in start.go but it was "/var/cache/sensu" in NewConfig.

Were there any complications while making this change?

I don't know Golang well ;)

@palourde
Copy link
Contributor

Bonjour Mathieu :)

Thank you very much for submitting this PR, it's really appreciated.

Concerning the default value for cacheDir, it should definitively use path.SystemCacheDir("sensu-agent"). Would you mind adding that to your PR? Everything else looks good!

- Moves all default values for the agent CLI into const in agent.go
- Uses theses const values in the agent CLI
- Modify NewConfig to return an empty Config
- Creates a new FixtureConfig function to create a new Config for tests
- Updates the tests to use FixtureConfig

Signed-off-by: mcorbin <corbin.math@gmail.com>
@mcorbin
Copy link
Contributor Author

mcorbin commented Feb 26, 2018

Bonjour Simon ;)

I updated the PR. It's now path.SystemCacheDir("sensu-agent") everywhere.

Copy link
Contributor

@mercul3s mercul3s left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Mathieu!

@mercul3s mercul3s merged commit ec1833b into sensu:master Feb 26, 2018
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.

Agent configuration cleanup
4 participants