Format relay credentials file with jinja

This commit is contained in:
Daniel Huber
2019-06-26 20:22:02 +02:00
parent 515e95076a
commit ae290482c0
2 changed files with 2 additions and 3 deletions

View File

@@ -0,0 +1 @@
{{ RELAYHOST }} {{ RELAYUSER }}:{{ RELAYPASSWORD }}

View File

@@ -50,9 +50,7 @@ for map_file in glob.glob("/overrides/*.map"):
if "RELAYUSER" in os.environ:
path = "/etc/postfix/sasl_passwd"
fileContent = "{} {}:{}".format(os.environ["RELAYHOST"], os.environ["RELAYUSER"], os.environ["RELAYPASSWORD"])
with open(path, "w") as f:
f.write(fileContent)
convert("/conf/sasl_passwd", path)
os.system("postmap {}".format(path))
convert("/conf/rsyslog.conf", "/etc/rsyslog.conf")