email: Reload postfix in domain view

This commit is contained in:
fliu 2021-08-09 19:23:06 +00:00 committed by Sunil Mohan Adapa
parent 27387d4a9c
commit 240b67c49e
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -6,6 +6,7 @@ import json
import os
import re
import select
import subprocess
import sys
import time
@ -111,6 +112,15 @@ def _action_set_keys():
set_function = globals()['su_set' + key]
set_function(value)
# Important: reload postfix after acquiring lock
with postconf.mutex.lock_all():
# systemctl reload postfix
args = ['systemctl', 'reload', 'postfix']
completed = subprocess.run(args, capture_output=True)
if completed.returncode != 0:
interproc.log_subprocess(completed)
raise OSError('Could not reload postfix')
def clean_mailname(mailname):
mailname = mailname.lower().strip()