From dfdd9bb129f9005177952942bbf83213fca36eef Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Mon, 8 Jul 2024 15:43:57 +0200 Subject: [PATCH] mail attachment: Remove deprecated parameter attach_unzip Remove deprecated parameter `attach_unzip` from default parameters so that IntelMQ Manager does not propose it for new bots instead use getattr/hasattr in the code --- CHANGELOG.md | 1 + intelmq/bots/collectors/mail/_lib.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a507edd43..254b73dfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Fixed timezone issue for collecting reports. - `intelmq.bots.collectors.shodan.collector_stream` (PR#2492 by Mikk Margus Möll): - Add `alert` parameter to Shodan stream collector to allow fetching streams by configured alert ID +- `intelmq.bots.collectors.mail._lib`: Remove deprecated parameter `attach_unzip` from default parameters (PR#2511 by Sebastian Wagner). #### Parsers - `intelmq.bots.parsers.shadowserver._config`: diff --git a/intelmq/bots/collectors/mail/_lib.py b/intelmq/bots/collectors/mail/_lib.py index 1d2dbc213..df2dd6cf4 100644 --- a/intelmq/bots/collectors/mail/_lib.py +++ b/intelmq/bots/collectors/mail/_lib.py @@ -17,7 +17,6 @@ class MailCollectorBot(CollectorBot): - attach_unzip = None mail_host = None ssl_ca_certificate = None mail_user = None @@ -35,8 +34,8 @@ def init(self): if imbox is None: raise MissingDependencyError("imbox") - if self.attach_unzip is not None and not self.extract_files: - self.extract_files = True + if getattr(self, 'attach_unzip', None) is not None and hasattr(self, 'extract_files'): + setattr(self, 'extract_files', True) self.logger.warning("The parameter 'attach_unzip' is deprecated and will " "be removed in version 4.0. Use 'extract_files' instead.")