feat: use ssh command exit code
parent
fed5e4953c
commit
1e8a5783bc
6
app.py
6
app.py
|
|
@ -96,6 +96,9 @@ def ssh_process(ssh, input_ssh):
|
||||||
|
|
||||||
stdin, stdout, stderr = ssh.exec_command(command_str)
|
stdin, stdout, stderr = ssh.exec_command(command_str)
|
||||||
|
|
||||||
|
ssh_exit_status = stdout.channel.recv_exit_status()
|
||||||
|
print(f"ssh exit status: {ssh_exit_status}")
|
||||||
|
|
||||||
out = "".join(stdout.readlines())
|
out = "".join(stdout.readlines())
|
||||||
out = out.strip() if out is not None else None
|
out = out.strip() if out is not None else None
|
||||||
if out:
|
if out:
|
||||||
|
|
@ -107,6 +110,9 @@ def ssh_process(ssh, input_ssh):
|
||||||
print(f"Error: \n{err}")
|
print(f"Error: \n{err}")
|
||||||
if out is None:
|
if out is None:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if ssh_exit_status != 0:
|
||||||
|
print(f"ssh exit status: {ssh_exit_status}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue