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

Consistent & strong validation for files & definitions, --validate_config #1254

Merged
merged 2 commits into from May 3, 2016

Conversation

Projects
None yet
5 participants
@portertech
Copy link
Member

commented May 3, 2016

This PR applies consistent strong configuration validation, for file loading and definition validation errors alike. This PR also adds the CLI argument/option --validate_config, which can be used to validate Sensu's latest configuration (on disk) prior to restarting the active Sensu service.

This PR closes #1244

Example --validate_config output:

$ bundle exec ./exe/sensu-client -c spec/config.json -d spec/conf.d --validate_config
configuration is valid
$ echo $?
0
$ emacs spec/config.json 
$ bundle exec ./exe/sensu-client -c spec/config.json -d spec/conf.d --validate_config
configuration is invalid
{
  "errors":[
    {
      "message":"config file must be valid json",
      "file":"spec/config.json",
      "error":"expected comma, not a string at line 6, column 11 [parse.c:381]"
    }
  ]
}
$ echo $?
2

@portertech portertech added this to the 0.24 milestone May 3, 2016

@portertech portertech self-assigned this May 3, 2016

@portertech

This comment has been minimized.

Copy link
Member Author

commented May 3, 2016

Going to abandon the idea of logging --validate_config log events to the associated service log (not safe). Need better output init system restart.

@portertech

This comment has been minimized.

Copy link
Member Author

commented May 3, 2016

tumblr_mvrc0evts81swhepeo1_250_zps371b1695

@luckymike

This comment has been minimized.

Copy link

commented May 3, 2016

LGTM!
🐛

@agoddard

This comment has been minimized.

Copy link
Member

commented May 3, 2016

:shipit:

@portertech portertech merged commit 405c145 into release/0.24 May 3, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@portertech portertech removed the in progress label May 3, 2016

@portertech portertech deleted the feature/validation branch May 3, 2016

@calebhailey

This comment has been minimized.

Copy link
Member

commented May 9, 2016

I'm excited about this one! Between this and --pring_config output (and ongoing documentation improvements), I think we're making huge steps towards demystifying a lot of the configuration-related issues that are confusing to new users, which is a big win. \o/

@sstarcher

This comment has been minimized.

Copy link

commented May 9, 2016

@portertech excellent work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.