v6.3.12.0

Changelog: https://roxy-wi.org/changelog#6_3_12
pull/364/head
Aidaho 2023-05-18 23:42:54 +03:00
parent d25cfef618
commit 4bbd195fbe
2 changed files with 22 additions and 20 deletions

View File

@ -843,50 +843,52 @@ def install_keepalived():
return_to_master = int(json_loads['return_to_master'])
router_id = random.randint(1, 255)
data = {'status': dict()}
data['status'][master] = dict()
data['status'][slave] = dict()
try:
service_mod.keepalived_master_install(master, eth, eth_slave, vrrp_ip, virt_server, syn_flood, return_to_master,
haproxy, nginx, router_id, 1)
except Exception as e:
data['status'][master] = {'keepalived': f'error: {e}'}
data['status'][master]['keepalived'] = f'error: {e}'
else:
data['status'][master] = {'keepalived': 'done'}
data['status'][master]['keepalived'] = 'done'
try:
service_mod.keepalived_slave_install(master, slave, eth, eth_slave, vrrp_ip, syn_flood, haproxy, nginx, router_id, 1)
except Exception as e:
data['status'][slave] = {'keepalived': f'error: {e}'}
data['status'][slave]['keepalived'] = f'error: {e}'
else:
data['status'][slave] = {'keepalived': 'done'}
data['status'][slave]['keepalived'] = 'done'
if haproxy:
try:
service_mod.install_haproxy(master)
service_mod.install_haproxy(master, 1)
except Exception as e:
data['status'][master] = {'haproxy': f'error: {e}'}
data['status'][master]['haproxy'] = f'error: {e}'
else:
data['status'][master] = {'haproxy': 'done'}
data['status'][master]['haproxy'] = 'done'
try:
service_mod.install_haproxy(slave)
service_mod.install_haproxy(slave, 1)
except Exception as e:
data['status'][slave] = {'haproxy': f'error: {e}'}
data['status'][slave]['haproxy'] = f'error: {e}'
else:
data['status'][slave] = {'haproxy': 'done'}
data['status'][slave]['haproxy'] = 'done'
if nginx:
try:
service_mod.install_service(master, 'nginx', '0')
service_mod.install_service(master, 'nginx', '0', 1)
except Exception as e:
data['status'][master] = {'nginx': f'error: {e}'}
data['status'][master]['nginx'] = f'error: {e}'
else:
data['status'][master] = {'nginx': 'done'}
data['status'][master]['nginx'] = 'done'
try:
service_mod.install_service(slave, 'nginx', '0')
service_mod.install_service(slave, 'nginx', '0', 1)
except Exception as e:
data['status'][slave] = {'nginx': f'error: {e}'}
data['status'][slave]['nginx'] = f'error: {e}'
else:
data['status'][slave] = {'nginx': 'done'}
data['status'][slave]['nginx'] = 'done'
return dict(data)

View File

@ -36,7 +36,7 @@ def show_installation_output(error: str, output: str, service: str, rc=0, api=0)
return True
def install_haproxy(server_ip: str, **kwargs):
def install_haproxy(server_ip: str, api=0, **kwargs):
script = "install_haproxy.sh"
hap_sock_p = str(sql.get_setting('haproxy_sock_port'))
stats_port = str(sql.get_setting('stats_port'))
@ -78,7 +78,7 @@ def install_haproxy(server_ip: str, **kwargs):
return_out = server_mod.subprocess_execute_with_rc(commands[0])
if show_installation_output(return_out['error'], return_out['output'], service, rc=return_out['rc']):
if show_installation_output(return_out['error'], return_out['output'], service, rc=return_out['rc'], api=api):
try:
sql.update_haproxy(server_ip)
except Exception as e:
@ -157,7 +157,7 @@ def waf_nginx_install(server_ip: str):
os.remove(script)
def install_service(server_ip: str, service: str, docker: str, **kwargs) -> None:
def install_service(server_ip: str, service: str, docker: str, api=0, **kwargs) -> None:
script = f"install_{service}.sh"
stats_user = sql.get_setting(f'{service}_stats_user')
stats_password = sql.get_setting(f'{service}_stats_password')
@ -203,7 +203,7 @@ def install_service(server_ip: str, service: str, docker: str, **kwargs) -> None
return_out = server_mod.subprocess_execute_with_rc(commands[0])
if show_installation_output(return_out['error'], return_out['output'], service_name, rc=return_out['rc']):
if show_installation_output(return_out['error'], return_out['output'], service_name, rc=return_out['rc'], api=api):
if service == 'nginx':
try:
sql.update_nginx(server_ip)