Revision 51144e33

b/lib/bootstrap.py
285 285
                constants.SSL_CERT_FILE, gntpem,
286 286
                constants.NODE_INITD_SCRIPT))
287 287

  
288
  result = sshrunner.Run(node, 'root', mycommand, batch=False, ask_key=True)
288
  result = sshrunner.Run(node, 'root', mycommand, batch=False, ask_key=True,
289
                         use_cluster_key=False)
289 290
  if result.failed:
290 291
    raise errors.OpExecError("Remote command on node %s, error: %s,"
291 292
                             " output: %s" %
b/lib/ssh.py
101 101
    return "-oHostKeyAlias=%s" % self.sstore.GetClusterName()
102 102

  
103 103
  def BuildCmd(self, hostname, user, command, batch=True, ask_key=False,
104
               tty=False):
104
               tty=False, use_cluster_key=True):
105 105
    """Build an ssh command to execute a command on a remote node.
106 106

  
107 107
    Args:
......
111 111
      batch: if true, ssh will run in batch mode with no prompting
112 112
      ask_key: if true, ssh will run with StrictHostKeyChecking=ask, so that
113 113
               we can connect to an unknown host (not valid in batch mode)
114
      use_cluster_key: Whether to expect and use the cluster-global SSH key
114 115

  
115 116
    Returns:
116 117
      The ssh call to run 'command' on the remote host.
......
118 119
    """
119 120
    argv = [constants.SSH, "-q"]
120 121
    argv.extend(KNOWN_HOSTS_OPTS)
121
    argv.append(self._GetHostKeyAliasOption())
122
    if use_cluster_key:
123
      argv.append(self._GetHostKeyAliasOption())
122 124
    if batch:
123 125
      # if we are in batch mode, we can't ask the key
124 126
      if ask_key:
......
131 133
    argv.extend(["%s@%s" % (user, hostname), command])
132 134
    return argv
133 135

  
134
  def Run(self, hostname, user, command, batch=True, ask_key=False):
136
  def Run(self, hostname, user, command, batch=True, ask_key=False,
137
          use_cluster_key=True):
135 138
    """Runs a command on a remote node.
136 139

  
137 140
    This method has the same return value as `utils.RunCmd()`, which it
......
150 153

  
151 154
    """
152 155
    return utils.RunCmd(self.BuildCmd(hostname, user, command, batch=batch,
153
                                      ask_key=ask_key))
156
                                      ask_key=ask_key,
157
                                      use_cluster_key=use_cluster_key))
154 158

  
155 159
  def CopyFileToNode(self, node, filename):
156 160
    """Copy a file to another node with scp.
b/scripts/gnt-node
37 37
  "pinst_cnt", "sinst_cnt",
38 38
  ]
39 39

  
40

  
40 41
def AddNode(opts, args):
41 42
  """Add node cli-to-processor bridge.
42 43

  

Also available in: Unified diff