mirror of https://github.com/Aidaho12/haproxy-wi
parent
cb135de852
commit
1728bbf882
|
@ -35,7 +35,7 @@ if service == 'keepalived':
|
||||||
action = "config.py?service=keepalived"
|
action = "config.py?service=keepalived"
|
||||||
configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
|
configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
|
||||||
format = 'conf'
|
format = 'conf'
|
||||||
servers = sql.is_master('123', master_slave=1)
|
servers = sql.get_dick_permit(keepalived=1)
|
||||||
elif service == 'nginx':
|
elif service == 'nginx':
|
||||||
title = "Working with Nginx configs"
|
title = "Working with Nginx configs"
|
||||||
action = "config.py?service=nginx"
|
action = "config.py?service=nginx"
|
||||||
|
|
|
@ -538,6 +538,7 @@ def get_dick_permit(**kwargs):
|
||||||
disable = ''
|
disable = ''
|
||||||
haproxy = ''
|
haproxy = ''
|
||||||
nginx = ''
|
nginx = ''
|
||||||
|
keepalived = ''
|
||||||
ip = ''
|
ip = ''
|
||||||
|
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
|
@ -557,6 +558,8 @@ def get_dick_permit(**kwargs):
|
||||||
haproxy = "and haproxy = 1"
|
haproxy = "and haproxy = 1"
|
||||||
if kwargs.get('nginx'):
|
if kwargs.get('nginx'):
|
||||||
nginx = "and nginx = 1"
|
nginx = "and nginx = 1"
|
||||||
|
if kwargs.get('keepalived'):
|
||||||
|
nginx = "and keepalived = 1"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cur.execute(sql)
|
cur.execute(sql)
|
||||||
|
@ -567,8 +570,8 @@ def get_dick_permit(**kwargs):
|
||||||
if group[5] == '1':
|
if group[5] == '1':
|
||||||
sql = """ select * from servers where enable = 1 %s %s %s """ % (disable, type_ip, nginx)
|
sql = """ select * from servers where enable = 1 %s %s %s """ % (disable, type_ip, nginx)
|
||||||
else:
|
else:
|
||||||
sql = """ select * from servers where groups like '%{group}%' and (enable = 1 {disable}) {type_ip} {ip} {haproxy} {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)
|
""".format(group=group[5], disable=disable, type_ip=type_ip, ip=ip, haproxy=haproxy, nginx=nginx, keepalived=keepalived)
|
||||||
try:
|
try:
|
||||||
cur.execute(sql)
|
cur.execute(sql)
|
||||||
except sqltool.Error as e:
|
except sqltool.Error as e:
|
||||||
|
|
|
@ -10,23 +10,10 @@
|
||||||
<select autofocus required name="serv" id="{{ select_id }}">
|
<select autofocus required name="serv" id="{{ select_id }}">
|
||||||
<option disabled>Choose server</option>
|
<option disabled>Choose server</option>
|
||||||
{% for select in selects %}
|
{% for select in selects %}
|
||||||
{% if service == 'keepalived' %}
|
{% if select.2 == serv %}
|
||||||
{% if select.1 == serv %}
|
<option value="{{ select.2 }}" selected>{{ select.1 }}</option>
|
||||||
<option value="{{ select.1 }}" selected>{{ select.0 }}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{ select.1 }}">{{ select.0 }}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% if select.3 == serv %}
|
|
||||||
<option value="{{ select.3 }}" selected>{{ select.2 }}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{ select.3 }}">{{ select.2 }}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if select.2 == serv %}
|
<option value="{{ select.2 }}">{{ select.1 }}</option>
|
||||||
<option value="{{ select.2 }}" selected>{{ select.1 }}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{ select.2 }}">{{ select.1 }}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue