zephyr_mirror: Fix support for forwarding mail zephyrs.

(imported from commit 4ab2c810d3ccff6058e6c0be2e172a78e216d0a5)
This commit is contained in:
Tim Abbott 2013-10-01 13:45:29 -04:00
parent 52e3d5bed5
commit b21b0557e8

View file

@ -22,6 +22,14 @@ supervisor_path = "/etc/supervisor/conf.d/%s.conf" % (program_name,)
template = "/home/humbug/humbug/bots/zmirror_private.conf.template"
template_data = file(template).read()
session_path = "/home/humbug/zephyr_sessions/%s" % (program_name,)
# Preserve mail zephyrs forwarding setting across rewriting the config file
try:
if "--forward-mail-zephyrs" in file(supervisor_path, "r").read():
template_data = template_data.replace("--use-sessions", "--use-sessions --forward-mail-zephyrs")
except Exception:
pass
file(supervisor_path, "w").write(template_data.replace("USERNAME", short_user))
# Delete your session