diff --git a/intelmq/bin/intelmqctl.py b/intelmq/bin/intelmqctl.py index 2add4b82e..9ad9266d0 100644 --- a/intelmq/bin/intelmqctl.py +++ b/intelmq/bin/intelmqctl.py @@ -941,6 +941,12 @@ def check(self, no_connections=False, check_executables=True): check_logger.error('SyntaxError in bot %r: %r', bot_id, exc) retval = 1 continue + except AttributeError: + # if module does not exist, utils.get_bot_module_name returns None. import_module then raises + # AttributeError: 'NoneType' object has no attribute 'startswith' + check_logger.error('Incomplete installation: Bot %r not importable.', bot_id,) + retval = 1 + continue bot = getattr(bot_module, 'BOT') bot_parameters = copy.deepcopy(global_settings) bot_parameters.update(bot_config.get('parameters', {})) # the parameters field may not exist diff --git a/intelmq/lib/utils.py b/intelmq/lib/utils.py index 5701db1af..294f4107a 100644 --- a/intelmq/lib/utils.py +++ b/intelmq/lib/utils.py @@ -852,7 +852,10 @@ def _get_console_entry_points(): return entries.get("console_scripts", []) # it's a dict -def get_bot_module_name(bot_name: str) -> str: +def get_bot_module_name(bot_name: str) -> Optional[str]: + """ + Returns None if the bot does not exist + """ entries = entry_points() if hasattr(entries, "select"): entries = tuple(entries.select(name=bot_name, group="console_scripts"))