Skip to content

smtp_batch: proper exit code when non-interactive #2608

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

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

Lukas-Heindl
Copy link
Contributor

This is only related to #2586 as that issue covers more than this PR. For the rest see the commit message.

@Lukas-Heindl
Copy link
Contributor Author

From my side this would be already finished (if the tests pass, but I expect them to do so with that little changes). Is there anything left to do for me?

@sebix
Copy link
Member

sebix commented Apr 24, 2025

The tests are broken, #2602 would fix that.

Do you mean smtp_batch: proper exit code when non-interactive?

@sebix sebix added bug Indicates an unexpected problem or unintended behavior component: bots labels Apr 24, 2025
@sebix sebix added this to the 3.4.1 Patch release milestone Apr 24, 2025
@Lukas-Heindl
Copy link
Contributor Author

No I think it's right this way. When the bot is interactive, I assume the exit code is not that important since a human is reading the output anyhow (also how to set the exit code if the first command (e.g. sending the first debug mail failed) but the second command succeded?).

So this change is supposed to handle the case when the bot is run via cli, but e.g. as cron job (so not interactively but with the --send flag). In this case no human reads the output usually and the exit code can help in triggering an alert something has gone wrong (triggering a human to look into the issue).

tests

So do I understand this correctly, are all PRs suspended at the moment, until that test-case is fixed?

Sending mails with the smtp_batch output might fail e.g. due to wrong
settings regarding the SMTP-Server. So far this is not reflected in the
exit code when running the bot via cli to trigger sending the mails.
Fixing this (at least for the non-interactive call) enables users to
integrate this into their monitoring properly.
@Lukas-Heindl
Copy link
Contributor Author

Now with the tests fixed, can you trigger the workflows on this?

@sebix
Copy link
Member

sebix commented Apr 28, 2025

No I think it's right this way. When the bot is interactive, I assume the exit code is not that important since a human is reading the output anyhow (also how to set the exit code if the first command (e.g. sending the first debug mail failed) but the second command succeded?).

So this change is supposed to handle the case when the bot is run via cli, but e.g. as cron job (so not interactively but with the --send flag). In this case no human reads the output usually and the exit code can help in triggering an alert something has gone wrong (triggering a human to look into the issue).

Thanks for the explanation. I confused (non-)interactive with the bot run mode (continuous/scheduled). Your logic makes sense of course :)

(also how to set the exit code if the first command (e.g. sending the first debug mail failed) but the second command succeded?).

My 2 cents on this - but I'm not a user of this bot: If any error occurred, the exit code would be non-zero (or the maximum of all potential exit codes). But that's neither important nor urgent to do.

@sebix sebix merged commit 38b9304 into certtools:develop Apr 28, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior component: bots
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants