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

Make config test exit with error code if broken #1577

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jamesoff
Copy link
Owner

Per discussion with @cpina, make -t exit non-zero (I picked 2) if something isn't right with the config. Mostly this covers using a monitor/alerter/logger type which isn't known; other config errors currently will just throw an exception and exit 1 still.

If not testing the config, then the previous behaviour is currently retained: SimpleMonitor will try to continue with the config it did load. Not sure if that's the best choice yet; it probably should exit if the config is broken either way.

@cpina
Copy link
Contributor

cpina commented Jan 19, 2025

Idea/suggestion/nitpick: use something that is not exit code 2. Why? argparse, by default, exits when there is an invalid command line parameter with error code 2 (see https://docs.python.org/es/3/library/argparse.html#exit-on-error).

And since exit code 1 is for, usually, exceptions (IIRC) then use exit code 3 for invalid configuration?

In practical terms for systemd integration it doesn't matter, so I am happy either way!

@jamesoff
Copy link
Owner Author

Nice catch, 3 it is then :)

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.

2 participants