1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-23 02:27:05 +00:00

Bugfix for the bug introduced while fixing the first bug. We now test config files again before writing!

This commit is contained in:
Justus Wingert 2023-08-15 14:33:50 +02:00
parent c1e4e33415
commit 89d50b35ef

View File

@ -119,13 +119,15 @@ def do_web_update(env):
for domain, conf in nginx_conf: for domain, conf in nginx_conf:
if "miab_%s" % domain not in sites_enabled: if "miab_%s" % domain not in sites_enabled:
warnings.append("Missing miab_%s in /etc/nginx/sites-enabled/\nCheck your configuration!" % domain) warnings.append("Missing miab_%s in /etc/nginx/sites-enabled/\nCheck your configuration!" % domain)
nginx_conf_fn = "/etc/nginx/sites-available/miab_%s" % domain nginx_conf_fn = "/etc/nginx/sites-available/miab_%s" % domain
with open(nginx_conf_fn, "w+") as f: if os.path.exists(nginx_conf_fn):
if f.read() == conf: with open(nginx_conf_fn) as f:
continue if f.read() == conf:
continue
# Save the file. # Save the file.
with open(nginx_conf_fn, "w") as f: with open(nginx_conf_fn, "w+") as f:
f.write(conf) f.write(conf)
kick = True kick = True
@ -138,7 +140,7 @@ def do_web_update(env):
return "web updated\n" + "\n".join(warnings) return "web updated\n" + "\n".join(warnings)
return "" + "\n".join(warnings) return "No changes.\n%s" % "\n".join(warnings)
def make_domain_config(domain, templates, ssl_certificates, env): def make_domain_config(domain, templates, ssl_certificates, env):
# GET SOME VARIABLES # GET SOME VARIABLES