From dec2561db283047eaf3c5b7b43519f425859df97 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 28 Jan 2022 17:02:36 -0600 Subject: [PATCH] Improve error handling when remote check fails --- libexec/check_rattail_daemon_by_ssh.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libexec/check_rattail_daemon_by_ssh.py b/libexec/check_rattail_daemon_by_ssh.py index 1ce64c2..5aa0391 100755 --- a/libexec/check_rattail_daemon_by_ssh.py +++ b/libexec/check_rattail_daemon_by_ssh.py @@ -108,7 +108,11 @@ if __name__ == '__main__': # Ok now connect, and try to get values for memory client = schecks.connect(hostname, port, ssh_key_file, passphrase, user) - result, exitcode = execute_check(client, check_path) - - print result - sys.exit(exitcode) + result = execute_check(client, check_path) + if result is False: + print("failed to execute remote check!") + sys.exit(3) + else: + output, exitcode = result + print(output) + sys.exit(exitcode)