Commit 31821208 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix the confusing ssh/hostname message in node add



Before, it used to say:

  ssh/hostname verification failed node1.example.com -> hostname mismatch, got
  node2

Now it says for wrong hostnames (maybe too verbose):

  ssh/hostname verification failed (checking from node1.example.com): hostname
  mismatch, expected node2.example.com but got node3

And for non-FQDN hostnames:

  ssh/hostname verification failed (checking from node1.example.com): hostname
  not FQDN: expected node2.example.com but got node2
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent bae7e531
......@@ -2431,7 +2431,8 @@ class LUAddNode(LogicalUnit):
" for remote verification" % verifier)
if result[verifier].data['nodelist']:
for failed in result[verifier].data['nodelist']:
feedback_fn("ssh/hostname verification failed %s -> %s" %
feedback_fn("ssh/hostname verification failed"
" (checking from %s): %s" %
(verifier, result[verifier].data['nodelist'][failed]))
raise errors.OpExecError("ssh/hostname verification failed.")
......
......@@ -227,7 +227,12 @@ class SshRunner:
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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment