mirror of https://github.com/Aidaho12/haproxy-wi
parent
ec0718f01f
commit
0d9afd8f42
|
@ -66,7 +66,7 @@ def get_backends_from_config(server_ip: str, backends='') -> None:
|
||||||
format_cfg = 'cfg'
|
format_cfg = 'cfg'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cfg = configs_dir + roxywi_comon.get_files(configs_dir, format_cfg)[0]
|
cfg = configs_dir + roxywi_common.get_files(configs_dir, format_cfg)[0]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
roxywi_common.logging('Roxy-WI server', str(e), roxywi=1)
|
roxywi_common.logging('Roxy-WI server', str(e), roxywi=1)
|
||||||
try:
|
try:
|
||||||
|
@ -89,7 +89,7 @@ def get_backends_from_config(server_ip: str, backends='') -> None:
|
||||||
print(line.split(' ')[1], end="<br>")
|
print(line.split(' ')[1], end="<br>")
|
||||||
|
|
||||||
|
|
||||||
def change_ip_and_port():
|
def change_ip_and_port() -> None:
|
||||||
backend_backend = common.checkAjaxInput(form.getvalue('backend_backend'))
|
backend_backend = common.checkAjaxInput(form.getvalue('backend_backend'))
|
||||||
backend_server = common.checkAjaxInput(form.getvalue('backend_server'))
|
backend_server = common.checkAjaxInput(form.getvalue('backend_server'))
|
||||||
backend_ip = common.checkAjaxInput(form.getvalue('backend_ip'))
|
backend_ip = common.checkAjaxInput(form.getvalue('backend_ip'))
|
||||||
|
@ -97,11 +97,11 @@ def change_ip_and_port():
|
||||||
|
|
||||||
if form.getvalue('backend_ip') is None:
|
if form.getvalue('backend_ip') is None:
|
||||||
print('error: Backend IP must be IP and not 0')
|
print('error: Backend IP must be IP and not 0')
|
||||||
sys.exit()
|
return
|
||||||
|
|
||||||
if form.getvalue('backend_port') is None:
|
if form.getvalue('backend_port') is None:
|
||||||
print('error: The backend port must be integer and not 0')
|
print('error: The backend port must be integer and not 0')
|
||||||
sys.exit()
|
return
|
||||||
|
|
||||||
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
|
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
|
||||||
|
|
||||||
|
@ -144,13 +144,13 @@ def change_ip_and_port():
|
||||||
config_mod.master_slave_upload_and_restart(serv, cfg, just_save='save')
|
config_mod.master_slave_upload_and_restart(serv, cfg, just_save='save')
|
||||||
|
|
||||||
|
|
||||||
def change_maxconn():
|
def change_maxconn() -> None:
|
||||||
frontend = common.checkAjaxInput(form.getvalue('maxconn_frontend'))
|
frontend = common.checkAjaxInput(form.getvalue('maxconn_frontend'))
|
||||||
maxconn = common.checkAjaxInput(form.getvalue('maxconn_int'))
|
maxconn = common.checkAjaxInput(form.getvalue('maxconn_int'))
|
||||||
|
|
||||||
if form.getvalue('maxconn_int') is None:
|
if form.getvalue('maxconn_int') is None:
|
||||||
print('error: Maxconn must be integer and not 0')
|
print('error: Maxconn must be integer and not 0')
|
||||||
sys.exit()
|
return
|
||||||
|
|
||||||
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
|
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
|
||||||
|
|
||||||
|
|
|
@ -910,8 +910,7 @@ def get_dick_permit(**kwargs):
|
||||||
try:
|
try:
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# out_error(e)
|
out_error(e)
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
return cursor.fetchall()
|
return cursor.fetchall()
|
||||||
|
|
||||||
|
@ -1586,7 +1585,6 @@ def insert_new_waf_rule(rule_name: str, rule_file: str, rule_description: str, s
|
||||||
return last_id
|
return last_id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def delete_waf_server(server_id):
|
def delete_waf_server(server_id):
|
||||||
query = Waf.delete().where(Waf.server_id == server_id)
|
query = Waf.delete().where(Waf.server_id == server_id)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1323,7 +1323,7 @@ if form.getvalue('install_grafana'):
|
||||||
if form.getvalue('haproxy_exp_install'):
|
if form.getvalue('haproxy_exp_install'):
|
||||||
import modules.service.exporter.installation as exp_installation
|
import modules.service.exporter.installation as exp_installation
|
||||||
|
|
||||||
exp_installtion.haproxy_exp_installation()
|
exp_installation.haproxy_exp_installation()
|
||||||
|
|
||||||
if form.getvalue('nginx_exp_install') or form.getvalue('apache_exp_install'):
|
if form.getvalue('nginx_exp_install') or form.getvalue('apache_exp_install'):
|
||||||
import modules.service.exporter.installation as exp_installation
|
import modules.service.exporter.installation as exp_installation
|
||||||
|
@ -3721,8 +3721,8 @@ if form.getvalue('loadchecker'):
|
||||||
telegrams=telegrams,
|
telegrams=telegrams,
|
||||||
groups=groups,
|
groups=groups,
|
||||||
slacks=slacks,
|
slacks=slacks,
|
||||||
user_status=user_status,
|
user_status=user_subscription['user_status'],
|
||||||
user_plan=user_plan,
|
user_plan=user_subscription['user_plan'],
|
||||||
haproxy_servers=haproxy_servers,
|
haproxy_servers=haproxy_servers,
|
||||||
nginx_servers=nginx_servers,
|
nginx_servers=nginx_servers,
|
||||||
apache_servers=apache_servers,
|
apache_servers=apache_servers,
|
||||||
|
|
|
@ -17,7 +17,7 @@ service = form.getvalue('service')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if serv is None:
|
if serv is None:
|
||||||
first_serv = servers
|
first_serv = user_params['servers']
|
||||||
for i in first_serv:
|
for i in first_serv:
|
||||||
serv = i[2]
|
serv = i[2]
|
||||||
break
|
break
|
||||||
|
|
|
@ -61,7 +61,7 @@ elif waf_rule_id and form.getvalue('config') is None:
|
||||||
elif service == 'nginx':
|
elif service == 'nginx':
|
||||||
config_path = sql.get_setting('nginx_dir')
|
config_path = sql.get_setting('nginx_dir')
|
||||||
|
|
||||||
config_file_name = comon.return_nice_path(config_path) + 'waf/rules/' + waf_rule_file
|
config_file_name = common.return_nice_path(config_path) + 'waf/rules/' + waf_rule_file
|
||||||
try:
|
try:
|
||||||
conf = open(cfg, "r")
|
conf = open(cfg, "r")
|
||||||
config_read = conf.read()
|
config_read = conf.read()
|
||||||
|
|
Loading…
Reference in New Issue