From 1728bbf8827875b21ca6643abbbb3e5e69e77870 Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Sat, 8 Feb 2020 20:12:25 +0300 Subject: [PATCH] v4.0.0.0 Changelog: https://haproxy-wi.org/changelog.py#4 --- app/config.py | 2 +- app/sql.py | 7 +++++-- app/templates/config.html | 19 +++---------------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/app/config.py b/app/config.py index efef5c68..1191862c 100644 --- a/app/config.py +++ b/app/config.py @@ -35,7 +35,7 @@ if service == 'keepalived': action = "config.py?service=keepalived" configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir') format = 'conf' - servers = sql.is_master('123', master_slave=1) + servers = sql.get_dick_permit(keepalived=1) elif service == 'nginx': title = "Working with Nginx configs" action = "config.py?service=nginx" diff --git a/app/sql.py b/app/sql.py index eb8abd48..30d6c2cd 100644 --- a/app/sql.py +++ b/app/sql.py @@ -538,6 +538,7 @@ def get_dick_permit(**kwargs): disable = '' haproxy = '' nginx = '' + keepalived = '' ip = '' con, cur = get_cur() @@ -557,6 +558,8 @@ def get_dick_permit(**kwargs): haproxy = "and haproxy = 1" if kwargs.get('nginx'): nginx = "and nginx = 1" + if kwargs.get('keepalived'): + nginx = "and keepalived = 1" try: cur.execute(sql) @@ -567,8 +570,8 @@ def get_dick_permit(**kwargs): if group[5] == '1': sql = """ select * from servers where enable = 1 %s %s %s """ % (disable, type_ip, nginx) else: - sql = """ select * from servers where groups like '%{group}%' and (enable = 1 {disable}) {type_ip} {ip} {haproxy} {nginx} - """.format(group=group[5], disable=disable, type_ip=type_ip, ip=ip, haproxy=haproxy, nginx=nginx) + sql = """ select * from servers where groups like '%{group}%' and (enable = 1 {disable}) {type_ip} {ip} {haproxy} {nginx} {keepalived} + """.format(group=group[5], disable=disable, type_ip=type_ip, ip=ip, haproxy=haproxy, nginx=nginx, keepalived=keepalived) try: cur.execute(sql) except sqltool.Error as e: diff --git a/app/templates/config.html b/app/templates/config.html index 9dccd846..db189edd 100644 --- a/app/templates/config.html +++ b/app/templates/config.html @@ -10,23 +10,10 @@