src/lsi/lsi.py
def _build_scp_command(hostname, username, idfile, is_get,
                       local_path, remote_path):
    """
    Uses hostname and other info to construct an SCP command.

    :param hostname: The hostname of the remote machine.
    :type hostname: ``str``
    :param username: The username to use on the remote machine.
    :type username: ``str``
    :param idfile: A path to the identity file to use.
    :type idfile: ``str``
    :param is_get: If true, we are getting a file rather than putting a file.
    :type is_get: ``bool``
    :param local_path: The path on the local file system.
    :type local_path: ``str``
    :param remote_path: The path on the remote file system.
    :type remote_path: ``str``
    """
    if hostname.strip() == '' or hostname is None:
        raise ValueError('Empty hostname')
    command = [_get_path('scp'),
               '-o', 'StrictHostKeyChecking=no',
               '-o', 'ConnectTimeout=5',
               '-o', 'UserKnownHostsFile={}'.format(_KNOWN_HOSTS_FILE)]
    if idfile is not None:
        command.extend(['-i', idfile])
    if username is not None:
        hostname = '%s@%s' % (username, hostname)
    remote_path = '{}:{}'.format(hostname, remote_path)
    if is_get:
        command.extend([remote_path, local_path])
    else:
        command.extend([local_path, remote_path])
    return ' '.join(command)
def _build_scp_command(hostname, username, idfile, is_get,
                       local_path, remote_path):
    if hostname.strip() == '' or hostname is None:
        raise ValueError('Empty hostname')
    command = [_get_path('scp'),
               '-o', 'StrictHostKeyChecking=no',
               '-o', 'ConnectTimeout=5',
               '-o', 'UserKnownHostsFile={}'.format(_KNOWN_HOSTS_FILE)]
    if idfile is not None:
        command.extend(['-i', idfile])
    if username is not None:
        hostname = '%s@%s' % (username, hostname)
    remote_path = '{}:{}'.format(hostname, remote_path)
    if is_get:
        command.extend([remote_path, local_path])
    else:
        command.extend([local_path, remote_path])
    return ' '.join(command)
def _build_scp_command ( hostname , username , idfile , is_get , local_path , remote_path ) : if hostname . strip ( ) == '' or hostname is None : raise ValueError ( 'Empty hostname' ) command = [ _get_path ( 'scp' ) , '-o' , 'StrictHostKeyChecking=no' , '-o' , 'ConnectTimeout=5' , '-o' , 'UserKnownHostsFile={}' . format ( _KNOWN_HOSTS_FILE ) ] if idfile is not None : command . extend ( [ '-i' , idfile ] ) if username is not None : hostname = '%s@%s' % ( username , hostname ) remote_path = '{}:{}' . format ( hostname , remote_path ) if is_get : command . extend ( [ remote_path , local_path ] ) else : command . extend ( [ local_path , remote_path ] ) return ' ' . join ( command )
Uses hostname and other info to construct an SCP command.

    :param hostname: The hostname of the remote machine.
    :type hostname: ``str``
    :param username: The username to use on the remote machine.
    :type username: ``str``
    :param idfile: A path to the identity file to use.
    :type idfile: ``str``
    :param is_get: If true, we are getting a file rather than putting a file.
    :type is_get: ``bool``
    :param local_path: The path on the local file system.
    :type local_path: ``str``
    :param remote_path: The path on the remote file system.
    :type remote_path: ``str``
Uses hostname and other info to construct an SCP command .