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

SyntaxError in bots causes intelmqctl check to crash #2177

Closed
wagner-intevation opened this issue May 17, 2022 · 0 comments · Fixed by #2265
Closed

SyntaxError in bots causes intelmqctl check to crash #2177

wagner-intevation opened this issue May 17, 2022 · 0 comments · Fixed by #2265
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior component: intelmqctl usability

Comments

@wagner-intevation
Copy link
Contributor

wagner-intevation commented May 17, 2022

intelmqctl check tries to import all bots to check if they exists and some other checks:

# importable module
try:
bot_module = importlib.import_module(bot_config['module'])
except ImportError as exc:
check_logger.error('Incomplete installation: Bot %r not importable: %r.', bot_id, exc)
retval = 1
continue

However, if the bot has a syntax error, this causes intelmqctl check to crash itself with an uncaught SyntaxError. In these cases the manager won't display anything useful.

This kind of error error should be caught as well.

@sebix sebix added bug Indicates an unexpected problem or unintended behavior usability component: intelmqctl labels May 17, 2022
@waldbauer-certat waldbauer-certat self-assigned this Nov 14, 2022
kamil-certat added a commit to kamil-certat/intelmq that referenced this issue Nov 15, 2022
The command 'intelmqctl check' can now handle SyntaxError
caused in bot's code without crashing. In addition,
the command got first unittests.

The 'utils.list_all_bots' command is adjusted to omit
modules with SyntaxErrors. This is consistent with the
'intelmqctl check' command behaviour, what is the only
one place this function is used.

closes: certtools#2177
kamil-certat added a commit to kamil-certat/intelmq that referenced this issue Dec 12, 2022
The command 'intelmqctl check' can now handle SyntaxError
caused in bot's code without crashing. In addition,
the command got first unittests.

The 'utils.list_all_bots' command is adjusted to omit
modules with SyntaxErrors. This is consistent with the
'intelmqctl check' command behaviour, what is the only
one place this function is used.

closes: certtools#2177
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: intelmqctl usability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants