Revision a9f33339 lib/bootstrap.py

b/lib/bootstrap.py
280 280

  
281 281

  
282 282
def RunNodeSetupCmd(cluster_name, node, basecmd, debug, verbose,
283
                    use_cluster_key, ask_key, strict_host_check, data):
283
                    use_cluster_key, ask_key, strict_host_check,
284
                    port, data):
284 285
  """Runs a command to configure something on a remote machine.
285 286

  
286 287
  @type cluster_name: string
......
299 300
  @param ask_key: See L{ssh.SshRunner.BuildCmd}
300 301
  @type strict_host_check: bool
301 302
  @param strict_host_check: See L{ssh.SshRunner.BuildCmd}
303
  @type port: int
304
  @param port: The SSH port of the remote machine or None for the default
302 305
  @param data: JSON-serializable input data for script (passed to stdin)
303 306

  
304 307
  """
......
311 314
  if verbose:
312 315
    cmd.append("--verbose")
313 316

  
317
  if port is None:
318
    port = netutils.GetDaemonPort(constants.SSH)
319

  
314 320
  family = ssconf.SimpleStore().GetPrimaryIPFamily()
315 321
  srun = ssh.SshRunner(cluster_name,
316 322
                       ipv6=(family == netutils.IP6Address.family))
......
318 324
                       utils.ShellQuoteArgs(cmd),
319 325
                       batch=False, ask_key=ask_key, quiet=False,
320 326
                       strict_host_check=strict_host_check,
321
                       use_cluster_key=use_cluster_key)
327
                       use_cluster_key=use_cluster_key,
328
                       port=port)
322 329

  
323 330
  tempfh = tempfile.TemporaryFile()
324 331
  try:
......
333 340
    raise errors.OpExecError("Command '%s' failed: %s" %
334 341
                             (result.cmd, result.fail_reason))
335 342

  
336
  _WaitForSshDaemon(node, netutils.GetDaemonPort(constants.SSH), family)
343
  _WaitForSshDaemon(node, port, family)
337 344

  
338 345

  
339 346
def _InitFileStorageDir(file_storage_dir):
......
874 881
                    " the node: %s", msg)
875 882

  
876 883

  
877
def SetupNodeDaemon(opts, cluster_name, node):
884
def SetupNodeDaemon(opts, cluster_name, node, ssh_port):
878 885
  """Add a node to the cluster.
879 886

  
880 887
  This function must be called before the actual opcode, and will ssh
......
883 890

  
884 891
  @param cluster_name: the cluster name
885 892
  @param node: the name of the new node
893
  @param ssh_port: the SSH port of the new node
886 894

  
887 895
  """
888 896
  data = {
......
895 903

  
896 904
  RunNodeSetupCmd(cluster_name, node, pathutils.NODE_DAEMON_SETUP,
897 905
                  opts.debug, opts.verbose,
898
                  True, opts.ssh_key_check, opts.ssh_key_check, data)
906
                  True, opts.ssh_key_check, opts.ssh_key_check,
907
                  ssh_port, data)
899 908

  
900 909
  _WaitForNodeDaemon(node)
901 910

  

Also available in: Unified diff