diff --git a/app/modules/service/haproxy.py b/app/modules/service/haproxy.py index 03678d88..22733809 100644 --- a/app/modules/service/haproxy.py +++ b/app/modules/service/haproxy.py @@ -251,8 +251,7 @@ def show_map(serv: str) -> str: def runtime_command(serv: str, enable: str, backend: str, save: str) -> str: server_state_file = sql.get_setting('server_state_file') haproxy_sock = sql.get_setting('haproxy_sock') - - cmd = f'echo "{enable} {backend}" |sudo socat stdio {haproxy_sock}' + cmd = f"echo {enable} {backend} |sudo socat stdio {haproxy_sock}" if save == "on": save_command = f'echo "show servers state" | sudo socat {haproxy_sock} stdio > {server_state_file}' @@ -260,14 +259,14 @@ def runtime_command(serv: str, enable: str, backend: str, save: str) -> str: else: command = [cmd] - if enable != "show": - roxywi_common.logging(serv, f'Has been {enable}ed {backend}', login=1, keep_history=1, service='haproxy') - print( - f'

You {enable} {backend} on HAProxy {serv}. Look it or Edit something else


') - - action = f'runtimeapi {enable} {backend}' - roxywi_common.logging(serv, action) - - return server_mod.ssh_command(serv, command, show_log="1") + try: + output = server_mod.ssh_command(serv, command, show_log="1") + except Exception as e: + return f'{e}' + else: + if enable != "show": + roxywi_common.logging(serv, f'Has been {enable}ed {backend}', login=1, keep_history=1, service='haproxy') + return f'

You {enable} {backend} on HAProxy {serv}. Look it or Edit something else


' \ + f'{output}' diff --git a/config_other/requirements_deb.txt b/config_other/requirements_deb.txt index f0d61f13..e701f850 100644 --- a/config_other/requirements_deb.txt +++ b/config_other/requirements_deb.txt @@ -7,7 +7,11 @@ distro>=1.2.0 retry>=0.9.2 psutil>=5.9.1 pdpyras>=4.5.2 -Flask-APScheduler>=1.12.4 +Werkzeug==2.0.3 +Flask==2.0.3 +Flask-Login==0.4.1 +Flask-APScheduler==1.12.4 +Flask-Caching==1.10.1 python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0