From 4fc0e9fa730646b4fc3ec418025a573555ecce0c Mon Sep 17 00:00:00 2001 From: Miguel Alexandre Date: Mon, 6 May 2019 13:52:20 +0100 Subject: [PATCH] Add ability to test the configuration without saving --- app/funct.py | 4 +++- app/templates/config.html | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/funct.py b/app/funct.py index 515b43e1..79c972bb 100644 --- a/app/funct.py +++ b/app/funct.py @@ -343,7 +343,9 @@ def upload_and_restart(serv, cfg, **kwargs): else: commands = [ "sudo mv -f " + tmp_file + " /etc/keepalived/keepalived.conf && sudo systemctl restart keepalived" ] else: - if kwargs.get("just_save") == "save": + if kwargs.get("just_save") == "test": + commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo rm -f " + tmp_file ] + elif kwargs.get("just_save") == "save": commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') ] else: commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') + " && sudo " + sql.get_setting('restart_command') ] diff --git a/app/templates/config.html b/app/templates/config.html index 71742aa5..eff5ff68 100644 --- a/app/templates/config.html +++ b/app/templates/config.html @@ -60,6 +60,7 @@

+