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

Add dry-run option to validate configuration #363

Merged
merged 1 commit into from
Nov 30, 2018
Merged

Add dry-run option to validate configuration #363

merged 1 commit into from
Nov 30, 2018

Conversation

sgissi
Copy link
Contributor

@sgissi sgissi commented Nov 29, 2018

Add dry-run flag to just parse configuration and exit. Fixes #355.

Signed-off-by: Silvio Gissi [email protected]

@k0ste
Copy link

k0ste commented Nov 30, 2018

Works as expected.

[k0ste@WorkStation]$ ./snmp_exporter --config.file=/tmp/snmp_exporter/snmp.yml --dry-run
INFO[0000] Starting snmp exporter (version=0.13.0, branch=dry-run-flag, revision=cb0fce9c4d19f237f6ea9e381aa7d68669384a73)  source="main.go:139"
INFO[0000] Build context (go=go1.11.2, user=k0ste@WorkStation, date=20181130-03:26:49)  source="main.go:140"
INFO[0000] Configuration parsed successfully.            source="main.go:151"
[k0ste@WorkStation snmp_exporter]$ echo $?
0
[k0ste@WorkStation]$ ./snmp_exporter --config.file=/tmp/snmp_exporter/snmp.yml --dry-run
INFO[0000] Starting snmp exporter (version=0.13.0, branch=dry-run-flag, revision=cb0fce9c4d19f237f6ea9e381aa7d68669384a73)  source="main.go:139"
INFO[0000] Build context (go=go1.11.2, user=k0ste@WorkStation, date=20181130-03:26:49)  source="main.go:140"
FATA[0000] Error parsing config file: yaml: unmarshal errors:
  line 3: cannot unmarshal !!str `1` into int  source="main.go:146"
[k0ste@WorkStation snmp_exporter]$ echo $?
1

@k0ste
Copy link

k0ste commented Nov 30, 2018

Resolve #355.

Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

LGTM.

@brian-brazil brian-brazil merged commit 0a61c79 into prometheus:master Nov 30, 2018
@brian-brazil
Copy link
Contributor

Thanks!

@sgissi sgissi deleted the dry-run-flag branch December 3, 2018 14:37
brian-brazil pushed a commit that referenced this pull request Feb 5, 2019
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.

4 participants