diff --git a/lib/bootstrap.py b/lib/bootstrap.py index 3045a44e80d047d55fcb237388aaa0b0232618e2..160c1a59af86fbc2d605cf37f99c9667ea905568 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -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" % diff --git a/scripts/gnt-node b/scripts/gnt-node index 20461b5877c25b5a99dca4f0e57c7e07a0d9a537..8acf34a8e64841a45a15380c3f0503b23ab91350 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -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>",