X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/a3f9f296fd8d14233b1d28a8168e34f8c485d69a..fc8a6b8f3334c1352caafcede1e31d801fc146ba:/lib/ssh.py diff --git a/lib/ssh.py b/lib/ssh.py index e87b19d..e891314 100644 --- a/lib/ssh.py +++ b/lib/ssh.py @@ -201,7 +201,7 @@ class SshRunner: connected to). This is used to detect problems in ssh known_hosts files - (conflicting known hosts) and incosistencies between dns/hosts + (conflicting known hosts) and inconsistencies between dns/hosts entries and local machine names @param node: nodename of a host to check; can be short or @@ -219,12 +219,20 @@ 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() if not remotehostname or remotehostname != node: - return False, "hostname mismatch, got %s" % remotehostname + if node.startswith(remotehostname + "."): + msg = "hostname not FQDN" + else: + msg = "hostname mistmatch" + return False, ("%s: expected %s but got %s" % + (msg, node, remotehostname)) return True, "host matches"