mirror of https://github.com/Aidaho12/haproxy-wi
parent
3300318616
commit
c5b33138ba
|
@ -112,13 +112,16 @@ def check_haproxy_config(server_ip):
|
||||||
else:
|
else:
|
||||||
commands = [f"haproxy -q -c -f {config_path}"]
|
commands = [f"haproxy -q -c -f {config_path}"]
|
||||||
|
|
||||||
|
try:
|
||||||
with mod_ssh.ssh_connect(server_ip) as ssh:
|
with mod_ssh.ssh_connect(server_ip) as ssh:
|
||||||
for command in commands:
|
for command in commands:
|
||||||
stdin, stdout, stderr = ssh.run_command(command)
|
stdin, stdout, stderr = ssh.run_command(command, timeout=5)
|
||||||
if not stderr.read():
|
if not stderr.read():
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f'error: {e}')
|
||||||
|
|
||||||
|
|
||||||
def check_nginx_config(server_ip):
|
def check_nginx_config(server_ip):
|
||||||
|
|
Loading…
Reference in New Issue