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

amtool should exit non-zero on error #898

Closed
jjneely opened this issue Jul 6, 2017 · 4 comments
Closed

amtool should exit non-zero on error #898

jjneely opened this issue Jul 6, 2017 · 4 comments

Comments

@jjneely
Copy link
Contributor

jjneely commented Jul 6, 2017

amtool should have a non-zero exit code during error so that failure can be detected easily by automation scripts. It look like the error object returned by commands is printed and then discarded here:

https://github.com/prometheus/alertmanager/blob/master/cli/utils.go#L90

@Kellel
Copy link
Contributor

Kellel commented Aug 2, 2017

Good Idea. I'll work on adding this

@Kellel
Copy link
Contributor

Kellel commented Aug 2, 2017

After taking a look i'm pretty sure it already does this

kellen@chewbacca:~/play/demo$ amtool kdkdk; echo $?
Error: unknown command "kdkdk" for "amtool"
Run 'amtool --help' for usage.
1

Am I missing something?

Edit: formatting

@Kellel
Copy link
Contributor

Kellel commented Aug 2, 2017

Oh it's not consistent

kellen@chewbacca:~/play/demo$ amtool silence add foo=bar ; echo $?
Error: Comment required by config
0

I see the issue now

Kellel pushed a commit to Kellel/alertmanager that referenced this issue Aug 2, 2017
Exit with error code from subcommands as well as root command
@Kellel
Copy link
Contributor

Kellel commented Aug 2, 2017

@jjneely Thanks for submitting a bug!

iksaif pushed a commit to iksaif/alertmanager that referenced this issue Sep 15, 2017
Exit with error code from subcommands as well as root command
hh pushed a commit to ii/alertmanager that referenced this issue Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants