From bee347c9f56b58b56509575a26c23d35b84707f3 Mon Sep 17 00:00:00 2001 From: jorgepastorr Date: Thu, 3 Oct 2024 12:35:01 +0200 Subject: [PATCH] orchestra list exec postmap after edit mailman3_virt* --- orchestra/contrib/lists/backends.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/orchestra/contrib/lists/backends.py b/orchestra/contrib/lists/backends.py index 29897ba4..97c61afd 100644 --- a/orchestra/contrib/lists/backends.py +++ b/orchestra/contrib/lists/backends.py @@ -57,6 +57,14 @@ class MailmanVirtualDomainController(ServiceController): def commit(self): context = self.get_context_files() super(MailmanVirtualDomainController, self).commit() + self.append(textwrap.dedent(""" + # Apply changes if needed + if [[ $UPDATED_VIRTUAL_ALIAS_DOMAINS == 1 ]]; then + postmap %(virtual_alias_domains)s + systemctl reload postfix + fi + exit $exit_code""") % context + ) def get_context_files(self): return { @@ -165,7 +173,18 @@ class MailmanController(MailmanVirtualDomainController): def commit(self): - pass + context = self.get_context_files() + self.append(textwrap.dedent(""" + # Apply changes if needed + if [[ $UPDATED_VIRTUAL_ALIAS == 1 ]]; then + postmap %(virtual_alias)s + fi + if [[ $UPDATED_VIRTUAL_ALIAS_DOMAINS == 1 ]]; then + systemctl reload postfix + fi + exit $exit_code""") % context + ) + def get_context_files(self): return {