self.cluster_name = cluster_name
def _BuildSshOptions(self, batch, ask_key, use_cluster_key,
self.cluster_name = cluster_name
def _BuildSshOptions(self, batch, ask_key, use_cluster_key,
@param use_cluster_key: if True, use the cluster name as the
HostKeyAlias name
@param strict_host_check: this makes the host key checking strict
@param use_cluster_key: if True, use the cluster name as the
HostKeyAlias name
@param strict_host_check: this makes the host key checking strict
- elif ask_key:
- options.extend([
- "-oStrictHostKeyChecking=ask",
- ])
+ else:
+ # non-batch mode
+
+ if ask_key:
+ options.append("-oStrictHostKeyChecking=ask")
+ elif strict_host_check:
+ options.append("-oStrictHostKeyChecking=yes")
+ else:
+ options.append("-oStrictHostKeyChecking=no")
return options
def BuildCmd(self, hostname, user, command, batch=True, ask_key=False,
return options
def BuildCmd(self, hostname, user, command, batch=True, ask_key=False,
- tty=False, use_cluster_key=True, strict_host_check=True):
+ tty=False, use_cluster_key=True, strict_host_check=True,
+ private_key=None):
"""Build an ssh command to execute a command on a remote node.
@param hostname: the target host, string
"""Build an ssh command to execute a command on a remote node.
@param hostname: the target host, string
@param use_cluster_key: whether to expect and use the
cluster-global SSH key
@param strict_host_check: whether to check the host's SSH key at all
@param use_cluster_key: whether to expect and use the
cluster-global SSH key
@param strict_host_check: whether to check the host's SSH key at all
@return: the ssh call to run 'command' on the remote host.
"""
argv = [constants.SSH, "-q"]
argv.extend(self._BuildSshOptions(batch, ask_key, use_cluster_key,
@return: the ssh call to run 'command' on the remote host.
"""
argv = [constants.SSH, "-q"]
argv.extend(self._BuildSshOptions(batch, ask_key, use_cluster_key,