From c7a707f90772a4a795411c5ba84434e953ef8e8a Mon Sep 17 00:00:00 2001 From: mwiegand Date: Mon, 14 Jun 2021 21:51:38 +0200 Subject: [PATCH] wip --- bundles/mailserver/items.py | 2 +- bundles/postfix/items.py | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/bundles/mailserver/items.py b/bundles/mailserver/items.py index f56867c..a898dc8 100644 --- a/bundles/mailserver/items.py +++ b/bundles/mailserver/items.py @@ -39,7 +39,7 @@ setup = f""" WHERE domains.name = 'example.com'; INSERT INTO users (name, domain_id, redirect) - SELECT 'bw_test_alias', domains.id, 'irgendweo@gmail.com' + SELECT 'bw_test_alias', domains.id, 'somewhere@example.com' FROM domains WHERE domains.name = 'example.com'; """ diff --git a/bundles/postfix/items.py b/bundles/postfix/items.py index afeee19..48105e5 100644 --- a/bundles/postfix/items.py +++ b/bundles/postfix/items.py @@ -17,11 +17,6 @@ files = { '/etc/postfix/master.cf': { **file_options, }, - '/etc/postfix/virtual_alias_maps.cf': { - 'content_type': 'mako', - 'context': node.metadata.get('mailserver/database'), - **file_options, - }, '/etc/postfix/virtual_mailbox_domains.cf': { 'content_type': 'mako', 'context': node.metadata.get('mailserver/database'), @@ -32,6 +27,11 @@ files = { 'context': node.metadata.get('mailserver/database'), **file_options, }, + '/etc/postfix/virtual_alias_maps.cf': { + 'content_type': 'mako', + 'context': node.metadata.get('mailserver/database'), + **file_options, + }, } svc_systemd['postfix'] = { @@ -39,3 +39,28 @@ svc_systemd['postfix'] = { 'postgres_db:mailserver', ], } + +actions['test_virtual_mailbox_domains'] = { + 'command': 'false', + 'unless': "postmap -q example.com pgsql:/etc/postfix/virtual_mailbox_domains.cf | grep -q '^example.com$'", + 'needs': [ + 'svc_systemd:postfix', + 'action:mailserver_update_test_pw', + ], +} +actions['test_virtual_mailbox_maps'] = { + 'command': 'false', + 'unless': "postmap -q bw_test_user@example.com pgsql:/etc/postfix/virtual_mailbox_maps.cf | grep -q '^bw_test_user@example.com$'", + 'needs': [ + 'svc_systemd:postfix', + 'action:mailserver_update_test_pw', + ], +} +actions['test_virtual_alias_maps'] = { + 'command': 'false', + 'unless': "postmap -q bw_test_alias@example.com pgsql:/etc/postfix/virtual_alias_maps.cf | grep -q '^somewhere@example.com$'", + 'needs': [ + 'svc_systemd:postfix', + 'action:mailserver_update_test_pw', + ], +}