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):