mirror of https://github.com/openspug/spug
fix issues
parent
de4bffbb50
commit
f414e9504f
|
@ -57,7 +57,7 @@ def ping_check(addr):
|
||||||
def host_executor(host, command):
|
def host_executor(host, command):
|
||||||
try:
|
try:
|
||||||
with host.get_ssh() as ssh:
|
with host.get_ssh() as ssh:
|
||||||
exit_code, out = ssh.exec_command(command)
|
exit_code, out = ssh.exec_command_raw(command)
|
||||||
if exit_code == 0:
|
if exit_code == 0:
|
||||||
return True, out or '检测状态正常'
|
return True, out or '检测状态正常'
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -29,7 +29,7 @@ def host_executor(host, command):
|
||||||
code, out, now = 1, None, time.time()
|
code, out, now = 1, None, time.time()
|
||||||
try:
|
try:
|
||||||
with host.get_ssh() as ssh:
|
with host.get_ssh() as ssh:
|
||||||
code, out = ssh.exec_command(command)
|
code, out = ssh.exec_command_raw(command)
|
||||||
except AuthenticationException:
|
except AuthenticationException:
|
||||||
out = 'ssh authentication fail'
|
out = 'ssh authentication fail'
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
|
|
Loading…
Reference in New Issue