email: postconf: Handle postconf returning an empty key

However, if /sbin/postconf complained, a KeyError will be raised
This commit is contained in:
fliu 2021-07-05 23:30:09 +00:00 committed by Sunil Mohan Adapa
parent aab3fe9c02
commit 573287cf28
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -71,7 +71,7 @@ def set_master_cf_options(service_flags, options):
def get_unsafe(key):
"""Get postconf value (no locking, no sanitization)"""
result = _run(['/sbin/postconf', key])
match = key + ' = '
match = key + ' ='
if not result.startswith(match):
raise KeyError(key)
return result[len(match):].strip()