From: Frank Brehm Date: Wed, 10 Apr 2024 15:02:45 +0000 (+0200) Subject: Fixing PostfixLogfileParser because of pickup data X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=347a1c5dac24b878d5fd2b3b0483556c17329ccf;p=pixelpark%2Fpp-admin-tools.git Fixing PostfixLogfileParser because of pickup data --- diff --git a/lib/pp_admintools/handler/pflogparse.py b/lib/pp_admintools/handler/pflogparse.py index 5f13b7b..b1d63c9 100644 --- a/lib/pp_admintools/handler/pflogparse.py +++ b/lib/pp_admintools/handler/pflogparse.py @@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__) _ = XLATOR.gettext ngettext = XLATOR.ngettext -__version__ = '0.5.1' +__version__ = '0.5.2' # ============================================================================= @@ -345,19 +345,21 @@ class PostfixLogfileParser(HandlingObject): LOG.debug(msg) return - if command == 'postfix/cleanup': + if command == 'postfix/pickup': m = self.re_pickup.search(message) if m: if postfix_id in self.chain: self.chain[postfix_id].pickup_from = m['from'] self.chain[postfix_id].pickup_uid = m['uid'] else: - msg = _('Did not found Postfix ID {!r} for pickup log entry.').format( - postfix_id) - if self.warn_on_parse_error: - LOG.warn(msg) - else: - LOG.debug(msg) + chain = PostfixLogchainInfo( + start=timestamp, + postfix_id=postfix_id, + smtpd_pid=pid, + pickup_from=m['from'], + pickup_uid=m['uid'], + ) + self.chain[postfix_id] = chain return if command == 'opendkim': @@ -383,7 +385,16 @@ class PostfixLogfileParser(HandlingObject): if m: bid = m['bounce_id'].strip() if bid: - self.chain[postfix_id].add_bounce_id(bid) + if postfix_id in self.chain: + self.chain[postfix_id].add_bounce_id(bid) + else: + msg = _( + 'Did not found Postfix ID {pfid!r} for Bounce ID {bid!r}.').format( + pfid=postfix_id, bid=bid) + if self.warn_on_parse_error: + LOG.warn(msg) + else: + LOG.debug(msg) return if self.verbose > 1: