confd client: copy the peers in UpdatePeerList
[ganeti-local] / lib / ssh.py
index f0362b4..31fbdbb 100644 (file)
@@ -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"