src/lsi/lsi.py
def _build_ssh_command(hostname, username, idfile, ssh_command, tunnel):
    """Uses hostname and other info to construct an SSH command."""
    command = [_get_path('ssh'),
               '-o', 'StrictHostKeyChecking=no',
               '-o', 'ConnectTimeout=5']
    if idfile is not None:
        command.extend(['-i', idfile])
    if tunnel is not None:
        # If there's a tunnel, run the ssh command on the tunneled host.
        command.extend(['-A', '-t', tunnel, 'ssh', '-A', '-t'])
    if username is not None:
        command.append('{}@{}'.format(username, hostname))
    else:
        command.append(hostname)
    if ssh_command is not None:
        command.append(repr(ssh_command))
    return(' '.join(command))
def _build_ssh_command(hostname, username, idfile, ssh_command, tunnel):
    """Uses hostname and other info to construct an SSH command."""
    command = [_get_path('ssh'),
               '-o', 'StrictHostKeyChecking=no',
               '-o', 'ConnectTimeout=5']
    if idfile is not None:
        command.extend(['-i', idfile])
    if tunnel is not None:
        # If there's a tunnel, run the ssh command on the tunneled host.
        command.extend(['-A', '-t', tunnel, 'ssh', '-A', '-t'])
    if username is not None:
        command.append('{}@{}'.format(username, hostname))
    else:
        command.append(hostname)
    if ssh_command is not None:
        command.append(repr(ssh_command))
    return(' '.join(command))
Uses hostname and other info to construct an SSH command.