Error on running the smtp_batch output bot with intelmq 3.5.0
Hi,
I checked out the recent version (3.5.0) sadly with this I get
$ intelmq.bots.outputs.smtp_batch.output --cli smtp-batched-output
smtp-batched-output: SMTPBatchOutputBot initialized with id smtp-batched-output and intelmq 3.5.0 and python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] as process 945100. Standalone mode: False.
smtp-batched-output: Bot is starting.
smtp-batched-output: Loading source pipeline and queue 'smtp-batched-output-queue'.
smtp-batched-output: Connected to source queue.
smtp-batched-output: No destination queues to load.
smtp-batched-output: Bot initialization completed
Traceback (most recent call last):
File "/opt/intelmq/venv/bin/intelmq.bots.outputs.smtp_batch.output", line 7, in <module>
sys.exit(BOT.run())
^^^^^^^^^
File "/opt/intelmq/venv/lib/python3.11/site-packages/intelmq/bots/outputs/smtp_batch/output.py", line 139, in run
[setattr(instance, k, v) for k, v in vars(parsed_args).items()]
File "/opt/intelmq/venv/lib/python3.11/site-packages/intelmq/bots/outputs/smtp_batch/output.py", line 139, in <listcomp>
[setattr(instance, k, v) for k, v in vars(parsed_args).items()]
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: property 'bot_id' of 'SMTPBatchOutputBot' object has no setter
smtp-batched-output: Bot stopped.
smtp-batched-output: Bot stopped.
I think this might be related to the addition of bot_id as property in https://github.com/certtools/intelmq/commit/d3864555b7579ef8be08939bcb1db88bea4e5b33 / https://github.com/certtools/intelmq/pull/2509
But I'm not too familiar with the internals of the bots, so I'm not sure if writing a setter for bot_id is really the right fix (or somehow ignore that field in the [setattr(instance, k, v) for k, v in vars(parsed_args).items()])
Hey,
this is an interesting edge case, I don't see any other place acting like this in the code base. I think the correct solution is to exclude the bot_id from the set values. It has been consumed the line before when creating the instance, and it looks it was always copied unintentionally as this line is used to set the bot parameters, not the ID.
So it would be something like changing https://github.com/certtools/intelmq/blob/49ab3115a7c5686f8898f223bc3ff1578dd3b36b/intelmq/bots/outputs/smtp_batch/output.py#L139 to
[setattr(instance, k, v) for k, v in vars(parsed_args).items() if k not in ["bot_id"]]
or
[setattr(instance, k, v) for k, v in vars(parsed_args).items() if k != "bot_id"]
Exactly