From 7d428fe0f6a22fef4dbf2b5b528d36914bdcb1a7 Mon Sep 17 00:00:00 2001
From: Pavel Loginov
Date: Sun, 3 Jan 2021 20:49:18 +0600
Subject: [PATCH] v4.5.7.0
Changelog: https://haproxy-wi.org/changelog.py#4_5_7
---
app/config.py | 23 ++++++++++-----
app/overview.py | 2 +-
app/templates/config.html | 62 +++++++++++++++++----------------------
inc/configshow.js | 23 ++++++++++++++-
4 files changed, 66 insertions(+), 44 deletions(-)
diff --git a/app/config.py b/app/config.py
index 94973950..be21f3eb 100644
--- a/app/config.py
+++ b/app/config.py
@@ -73,36 +73,45 @@ if serv is not None and form.getvalue('open') is not None:
except IOError:
error += ' Cannot read import config file'
- os.system("/bin/mv %s %s.old" % (cfg, cfg))
+ os.system("/bin/mv %s %s.old" % (cfg, cfg))
if serv is not None and form.getvalue('config') is not None:
+ import sys
funct.check_is_server_in_group(serv)
try:
funct.logging(serv, "config.py edited config")
except Exception:
pass
-
+
config = form.getvalue('config')
oldcfg = form.getvalue('oldconfig')
save = form.getvalue('save')
- aftersave = 1
+
try:
with open(cfg, "a") as conf:
conf.write(config)
except IOError:
- error = "Can't read import config file"
-
+ print("error: Cannot read import config file")
+
if service == 'keepalived':
stderr = funct.upload_and_restart(serv, cfg, just_save=save, keepalived=1)
elif service == 'nginx':
stderr = funct.master_slave_upload_and_restart(serv, cfg, just_save=save, nginx=1)
else:
stderr = funct.master_slave_upload_and_restart(serv, cfg, just_save=save)
-
+
funct.diff_config(oldcfg, cfg)
-
+
os.system("/bin/rm -f " + configs_dir + "*.old")
+ if stderr:
+ print(stderr)
+ else:
+ if save == 'test':
+ print('Config is ok')
+ else:
+ print('Config is ok Config has been updated')
+ sys.exit()
template = template.render(h2=1, title=title,
role=role,
diff --git a/app/overview.py b/app/overview.py
index 93405493..94bfcffc 100644
--- a/app/overview.py
+++ b/app/overview.py
@@ -29,7 +29,7 @@ try:
for s in servers:
i += 1
if i != servers_len:
- servers_for_grep += s[2]+'|'
+ servers_for_grep += s[2]+'\|'
else:
servers_for_grep += s[2]
diff --git a/app/templates/config.html b/app/templates/config.html
index 586765d1..a635c3a7 100644
--- a/app/templates/config.html
+++ b/app/templates/config.html
@@ -4,6 +4,7 @@
+
{% if selects|length == 0 %}
{% include 'include/getstarted.html' %}
@@ -42,45 +43,36 @@
{% endif %}
- {% if not aftersave %}
- {% if stderr or error %}
- {% include 'include/errors.html' %}
- {% endif %}
+
+ {% if stderr or error %}
+ {% include 'include/errors.html' %}
{% endif %}
+
{% if config %}
{% if role <= 3 %}
-
Config from {{ serv }}
-
-
- {% if note %}
-
Note: When reconfiguring the master server, the slave will be reconfigured automatically
+
Config from {{ serv }}
+
+
+
Note: When reconfiguring the master server, the slave will be reconfigured automatically