From 5d591fdf7f172661cd5efdeb6fa4e4039aa9679d Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Fri, 6 Nov 2020 10:39:44 +0600 Subject: [PATCH] v4.5.3.0 Changelog: https://haproxy-wi.org/changelog.py#4_5_3 --- app/sections.py | 47 ++++++++++++++++++------------------- app/templates/config.html | 4 ++-- app/templates/sections.html | 14 ++++++----- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/app/sections.py b/app/sections.py index bac950ba..7402823a 100644 --- a/app/sections.py +++ b/app/sections.py @@ -2,7 +2,7 @@ import os import funct from jinja2 import Environment, FileSystemLoader -env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,extensions=['jinja2.ext.loopcontrols']) +env = Environment(loader=FileSystemLoader('templates/'), autoescape=True, extensions=['jinja2.ext.loopcontrols']) template = env.get_template('sections.html') print('Content-type: text/html\n') @@ -22,7 +22,7 @@ end_line = "" try: user, user_id, role, token, servers = funct.get_users_params() -except: +except Exception: pass hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir') @@ -32,11 +32,11 @@ if serv is not None and open is not None: error = funct.get_config(serv, cfg) sections = funct.get_sections(cfg) -if serv is not None and section is not None : +if serv is not None and section is not None: try: funct.logging(serv, "sections.py open config") - except: + except Exception: pass start_line, end_line, config_read = funct.get_section_from_config(cfg, section) @@ -46,7 +46,7 @@ if serv is not None and section is not None : if serv is not None and form.getvalue('config') is not None: try: funct.logging(serv, "config.py edited config") - except: + except Exception: pass config = form.getvalue('config') @@ -71,23 +71,22 @@ if serv is not None and form.getvalue('config') is not None: os.system("/bin/rm -f " + hap_configs_dir + "*.old") -template = template.render(h2 = 1, title = "Working with HAProxy configs", - role = role, - action = "sections.py", - user = user, - select_id = "serv", - serv = serv, - aftersave = aftersave, - config = config_read, - cfg = cfg, - selects = servers, - stderr = stderr, - error = error, - start_line = start_line, - end_line = end_line, - section = section, - sections = sections, - note = 1, - versions = funct.versions(), - token = token) +template = template.render(h2=1, title="Working with HAProxy configs", + role=role, + action="sections.py", + user=user, + select_id="serv", + serv=serv, + aftersave=aftersave, + config=config_read, + cfg=cfg, + selects=servers, + stderr=stderr, + error=error, + start_line=start_line, + end_line=end_line, + section=section, + sections=sections, + versions=funct.versions(), + token=token) print(template) diff --git a/app/templates/config.html b/app/templates/config.html index 59d01cb6..586765d1 100644 --- a/app/templates/config.html +++ b/app/templates/config.html @@ -70,7 +70,7 @@

{% if note %} -
Note: If you reconfigure Master server, Slave will reconfigured automatically
+
Note: When reconfiguring the master server, the slave will be reconfigured automatically
{% endif %} {% endif %} {% endif %} @@ -80,7 +80,7 @@ {% include 'include/errors.html' %} {% else %}
Config is ok
- Go to view stats + Go to stats {% endif %} {% endif %} diff --git a/app/templates/sections.html b/app/templates/sections.html index c1015211..56e5947c 100644 --- a/app/templates/sections.html +++ b/app/templates/sections.html @@ -26,7 +26,7 @@ {% if config %} {% if role <= 3 %}
-

You are editting "{{section}}" from server {{ serv }}

+

You are editing "{{section}}" section from server {{ serv }}

@@ -44,9 +44,11 @@

- {% if note %} -
Note: If you reconfigure Master server, Slave will reconfigured automatically
- {% endif %} +
+

Note:

+

When reconfiguring the master server, the slave will be reconfigured automatically

+

Unable to delete entire section

+
@@ -68,8 +70,8 @@ {% include 'include/errors.html' %} {% else %}
Config is ok
- Configs | - Go to view stats + Config | + Go to stats {% endif %} {% endif %}