Skip to content
Snippets Groups Projects
Commit c4b6c29c authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

gnt-node: Add option to always accept peer's SSH key

This option will be used to add nodes to the cluster without
asking the user to confirm the key. Together with key based
authentication this can be used in the QA tests.

Reviewed-by: ultrotter
parent 652d6694
No related branches found
No related tags found
Loading
......@@ -243,7 +243,7 @@ def FinalizeClusterDestroy(master):
logging.warning("Could not shutdown the node daemon and cleanup the node")
def SetupNodeDaemon(node):
def SetupNodeDaemon(node, ssh_key_check):
"""Add a node to the cluster.
This function must be called before the actual opcode, and will ssh
......@@ -285,8 +285,10 @@ def SetupNodeDaemon(node):
constants.SSL_CERT_FILE, gntpem,
constants.NODE_INITD_SCRIPT))
result = sshrunner.Run(node, 'root', mycommand, batch=False, ask_key=True,
use_cluster_key=False)
result = sshrunner.Run(node, 'root', mycommand, batch=False,
ask_key=ssh_key_check,
use_cluster_key=False,
strict_host_check=ssh_key_check)
if result.failed:
raise errors.OpExecError("Remote command on node %s, error: %s,"
" output: %s" %
......
......@@ -61,7 +61,7 @@ def AddNode(opts, args):
"on the target machine (%s) with the ones of the current one\n"
"and grant full intra-cluster ssh root access to/from it\n" % node)
bootstrap.SetupNodeDaemon(node)
bootstrap.SetupNodeDaemon(node, opts.ssh_key_check)
op = opcodes.OpAddNode(node_name=args[0], secondary_ip=opts.secondary_ip,
readd=opts.readd)
......@@ -314,8 +314,12 @@ commands = {
make_option("--readd", dest="readd",
default=False, action="store_true",
help="Readd old node after replacing it"),
make_option("--no-ssh-key-check", dest="ssh_key_check",
default=True, action="store_false",
help="Disable SSH key fingerprint checking"),
],
"[-s ip] [--readd] <node_name>", "Add a node to the cluster"),
"[-s ip] [--readd] [--no-ssh-key-check] <node_name>",
"Add a node to the cluster"),
'evacuate': (EvacuateNode, ARGS_FIXED(2),
[DEBUG_OPT, FORCE_OPT],
"[-f] <src> <dst>",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment