Revision a9f33339 lib/client/gnt_node.py

b/lib/client/gnt_node.py
193 193
  return result
194 194

  
195 195

  
196
def _SetupSSH(options, cluster_name, node):
196
def _SetupSSH(options, cluster_name, node, ssh_port):
197 197
  """Configures a destination node's SSH daemon.
198 198

  
199 199
  @param options: Command line options
......
201 201
  @param cluster_name: Cluster name
202 202
  @type node: string
203 203
  @param node: Destination node name
204
  @type ssh_port: int
205
  @param ssh_port: Destination node ssh port
204 206

  
205 207
  """
206 208
  if options.force_join:
......
226 228

  
227 229
  bootstrap.RunNodeSetupCmd(cluster_name, node, pathutils.PREPARE_NODE_JOIN,
228 230
                            options.debug, options.verbose, False,
229
                            options.ssh_key_check, options.ssh_key_check, data)
231
                            options.ssh_key_check, options.ssh_key_check,
232
                            ssh_port, data)
230 233

  
231 234

  
232 235
@UsesRPC
......
244 247
  node = netutils.GetHostname(name=args[0]).name
245 248
  readd = opts.readd
246 249

  
250
  # Retrieve relevant parameters of the node group.
251
  ssh_port = None
252
  if opts.nodegroup:
253
    try:
254
      output = cl.QueryGroups(names=[opts.nodegroup], fields=["ndp/ssh_port"],
255
                              use_locking=False)
256
      (ssh_port, ) = output[0]
257
    except (errors.OpPrereqError, errors.OpExecError):
258
      pass
259

  
247 260
  try:
248
    output = cl.QueryNodes(names=[node], fields=["name", "sip", "master"],
261
    output = cl.QueryNodes(names=[node],
262
                           fields=["name", "sip", "master", "ndp/ssh_port"],
249 263
                           use_locking=False)
250
    node_exists, sip, is_master = output[0]
264
    node_exists, sip, is_master, ssh_port = output[0]
251 265
  except (errors.OpPrereqError, errors.OpExecError):
252 266
    node_exists = ""
253 267
    sip = None
......
279 293
             "and grant full intra-cluster ssh root access to/from it\n", node)
280 294

  
281 295
  if opts.node_setup:
282
    _SetupSSH(opts, cluster_name, node)
296
    _SetupSSH(opts, cluster_name, node, ssh_port)
283 297

  
284
  bootstrap.SetupNodeDaemon(opts, cluster_name, node)
298
  bootstrap.SetupNodeDaemon(opts, cluster_name, node, ssh_port)
285 299

  
286 300
  if opts.disk_state:
287 301
    disk_state = utils.FlatToDict(opts.disk_state)

Also available in: Unified diff