From 46d7b95aa55c1436dfc753f7a8660d0a8828854b Mon Sep 17 00:00:00 2001 From: Vicente <45470655+amorfo77@users.noreply.github.com> Date: Sat, 11 Mar 2023 09:59:56 +0100 Subject: [PATCH] Update logging messages - Update log messages when mailcow target is not present or not in first place - fix indentation --- data/Dockerfiles/netfilter/server.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/Dockerfiles/netfilter/server.py b/data/Dockerfiles/netfilter/server.py index 745ab472..4e7ce1d4 100644 --- a/data/Dockerfiles/netfilter/server.py +++ b/data/Dockerfiles/netfilter/server.py @@ -541,11 +541,11 @@ def mailcowChainOrder(): if item.target.name == 'MAILCOW': target_found = True if position > 2: - logCrit('Error in %s chain order: MAILCOW on position %d, restarting container' % (chain.name, position)) + logCrit(f'MAILCOW target is in position {position} in the {chain.name} chain, restarting container to fix it...') quit_now = True exit_code = 2 if not target_found: - logCrit('Error in %s chain: MAILCOW target not found, restarting container' % (chain.name)) + logCrit(f'MAILCOW target not found in {chain.name} chain, restarting container to fix it...') quit_now = True exit_code = 2 else: @@ -555,12 +555,12 @@ def mailcowChainOrder(): if chain_position is None: continue if chain_position is False: - logCrit('Error in %s %s chain: MAILCOW target not found, restarting container' % (family, chain)) + logCrit(f'MAILCOW target not found in {family} {chain} table, restarting container to fix it...') quit_now = True exit_code = 2 if chain_position > 0: - logCrit('Error in %s %s chain order: MAILCOW on position %d, restarting container' % (family, chain, chain_position)) + logCrit(f'MAILCOW target is in position {chain_position} in the {family} {chain} table, restarting container to fix it...') quit_now = True exit_code = 2 @@ -898,8 +898,8 @@ def snat4(snat_target): logInfo(f'Remove rule for source network {new_rule.src} to SNAT target {snat_target} from POSTROUTING chain at position {position}') chain.delete_rule(rule) - table.commit() - table.autocommit = True + table.commit() + table.autocommit = True else: snat_rule("ip", snat_target) except: