X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/5bbd3f7f72506933b9ab86d2d1faff85ab3b4551..db16986583057d9258b6b29e15121b6d608d68e1:/lib/ssh.py diff --git a/lib/ssh.py b/lib/ssh.py index f0362b4..31fbdbb 100644 --- a/lib/ssh.py +++ b/lib/ssh.py @@ -212,7 +212,7 @@ class SshRunner: - detail: string with details """ - retval = self.Run(node, 'root', 'hostname') + retval = self.Run(node, 'root', 'hostname --fqdn') if retval.failed: msg = "ssh problem" @@ -221,13 +221,18 @@ class SshRunner: msg += ": %s" % output else: msg += ": %s (no output)" % retval.fail_reason - logging.error("Command %s failed: %s" % (retval.cmd, msg)) + 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"