From bf366817d7101ebf05509afa462c062f54b12f06 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 10 Jul 2018 10:00:56 -0500 Subject: [PATCH] Use `postconf -e` instead of our home-grown solution for that --- rattail_fabric/postfix.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/rattail_fabric/postfix.py b/rattail_fabric/postfix.py index a684617..cce6215 100644 --- a/rattail_fabric/postfix.py +++ b/rattail_fabric/postfix.py @@ -59,14 +59,11 @@ def restart(): sudo('service postfix restart') -def set_config(setting, value, path='/etc/postfix/main.cf'): +def set_config(setting, value): """ Configure the given setting with the given value. """ - # replace setting if already exists; then add in case it didn't - entry = '{} = {}'.format(setting, value) - sed(path, r'^{} = .*$'.format(setting), entry, use_sudo=True) - append(path, entry, use_sudo=True) + sudo("postconf -e '{}={}'".format(setting, value)) def set_myhostname(hostname):