projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert os api version file name to a constant
[ganeti-local]
/
lib
/
ssh.py
diff --git
a/lib/ssh.py
b/lib/ssh.py
index
0140587
..
e891314
100644
(file)
--- a/
lib/ssh.py
+++ b/
lib/ssh.py
@@
-25,6
+25,7
@@
import os
import os
+import logging
from ganeti import utils
from ganeti import errors
from ganeti import utils
from ganeti import errors
@@
-200,7
+201,7
@@
class SshRunner:
connected to).
This is used to detect problems in ssh known_hosts files
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
entries and local machine names
@param node: nodename of a host to check; can be short or
@@
-218,12
+219,20
@@
class SshRunner:
output = retval.output
if output:
msg += ": %s" % output
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, 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"
return True, "host matches"
@@
-232,6
+241,6
@@
def WriteKnownHostsFile(cfg, file_name):
"""Writes the cluster-wide equally known_hosts file.
"""
"""Writes the cluster-wide equally known_hosts file.
"""
- utils.WriteFile(file_name, mode=0700,
+ utils.WriteFile(file_name, mode=0600,
data="%s ssh-rsa %s\n" % (cfg.GetClusterName(),
cfg.GetHostKey()))
data="%s ssh-rsa %s\n" % (cfg.GetClusterName(),
cfg.GetHostKey()))