mirror of https://github.com/Aidaho12/haproxy-wi
parent
808b977f18
commit
1e14b128a5
13
app/funct.py
13
app/funct.py
|
@ -246,9 +246,9 @@ def ssh_connect(serv, **kwargs):
|
||||||
k = paramiko.pkey.load_private_key_file(ssh_key_name, password=cloud)
|
k = paramiko.pkey.load_private_key_file(ssh_key_name, password=cloud)
|
||||||
else:
|
else:
|
||||||
k = paramiko.pkey.load_private_key_file(ssh_key_name)
|
k = paramiko.pkey.load_private_key_file(ssh_key_name)
|
||||||
ssh.connect(hostname=serv, port=ssh_port, username=ssh_user_name, pkey=k, timeout=11)
|
ssh.connect(hostname=serv, port=ssh_port, username=ssh_user_name, pkey=k, timeout=11, banner_timeout=200)
|
||||||
else:
|
else:
|
||||||
ssh.connect(hostname=serv, port=ssh_port, username=ssh_user_name, password=ssh_user_password, timeout=11)
|
ssh.connect(hostname=serv, port=ssh_port, username=ssh_user_name, password=ssh_user_password, timeout=11, banner_timeout=200)
|
||||||
return ssh
|
return ssh
|
||||||
except paramiko.AuthenticationException:
|
except paramiko.AuthenticationException:
|
||||||
return 'Authentication failed, please verify your credentials'
|
return 'Authentication failed, please verify your credentials'
|
||||||
|
@ -997,10 +997,6 @@ def ssh_command(serv, commands, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def escape_html(text):
|
|
||||||
return cgi.escape(text, quote=True)
|
|
||||||
|
|
||||||
|
|
||||||
def subprocess_execute(cmd):
|
def subprocess_execute(cmd):
|
||||||
import subprocess
|
import subprocess
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True)
|
||||||
|
@ -1144,7 +1140,10 @@ def out_error(e):
|
||||||
error = e
|
error = e
|
||||||
else:
|
else:
|
||||||
error = e.args[0]
|
error = e.args[0]
|
||||||
logging('localhost', error, haproxywi=1, login=1)
|
try:
|
||||||
|
logging('localhost', error, haproxywi=1, login=1)
|
||||||
|
except Exception:
|
||||||
|
logging('localhost', error, haproxywi=1)
|
||||||
print('error: '+error)
|
print('error: '+error)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue