From c5b33138ba95b06abaeb7d5956653c925a6e3125 Mon Sep 17 00:00:00 2001 From: Aidaho Date: Sun, 26 Mar 2023 11:56:31 +0300 Subject: [PATCH] v6.3.8.0 Changelog: https://roxy-wi.org/changelog#6_3_8 --- app/modules/service/common.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/modules/service/common.py b/app/modules/service/common.py index ac0c1e1b..bbf4d2d3 100644 --- a/app/modules/service/common.py +++ b/app/modules/service/common.py @@ -112,13 +112,16 @@ def check_haproxy_config(server_ip): else: commands = [f"haproxy -q -c -f {config_path}"] - with mod_ssh.ssh_connect(server_ip) as ssh: - for command in commands: - stdin, stdout, stderr = ssh.run_command(command) - if not stderr.read(): - return True - else: - return False + try: + with mod_ssh.ssh_connect(server_ip) as ssh: + for command in commands: + stdin, stdout, stderr = ssh.run_command(command, timeout=5) + if not stderr.read(): + return True + else: + return False + except Exception as e: + print(f'error: {e}') def check_nginx_config(server_ip):