From a162cf5b6e67d48b048df0cd03bdaeb8e5bbdb70 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 3 Feb 2009 10:55:19 +0000
Subject: [PATCH] ssh: more details on failure

In case we fail without output from the ssh command, we should at least
add the exit code or any other failure reason to the error message, and
log it and the cmdline used to the node daemon log.

Reviewed-by: imsnah
---
 lib/ssh.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/ssh.py b/lib/ssh.py
index e87b19da7..40df99965 100644
--- a/lib/ssh.py
+++ b/lib/ssh.py
@@ -219,6 +219,9 @@ class SshRunner:
       output = retval.output
       if output:
         msg += ": %s" % output
+      else:
+        msg += ": %s (no output)" % retval.fail_reason
+      logging.error("Command %s failed: %s" % (retval.cmd, msg))
       return False, msg
 
     remotehostname = retval.stdout.strip()
-- 
GitLab