예제 #1
0
def get(remote: str, local: str, preserve_mode: bool = True) -> Result:
    """
    Скачать файл с сервера
    <http://docs.fabfile.org/en/2.5/api/transfer.html#fabric.transfer.Transfer.get>

    :param remote: путь до файла на сервере
    :param local: путь куда сохранить файл
    :param preserve_mode: сохранить права
    """
    t = Transfer(global_context.conn)
    return t.get(remote=remote, local=local, preserve_mode=preserve_mode)
예제 #2
0
def cli_copy_from_remote_to_local(host_ip: str, linux_user: str,
                                  linux_password: str, remote_source: str,
                                  local_destination: str) -> dict:
    """
    CLI Run - Run a Linux command 
    [Args]
        (str) host_ip: 
        (str) linux_user: 
        (str) linux_password: 
        (str) cmd: 
    [Returns]
        (dict) CLI Run response
    """
    try:
        c = Connection(linux_user + "@" + host_ip,
                       connect_kwargs={'password': linux_password})
        t = Transfer(c)
        return t.get(remote=remote_source,
                     local=local_destination,
                     preserve_mode=True)

    except Exception as e:
        return {"Error": str(e)}
예제 #3
0
파일: transfer.py 프로젝트: tivak/carnival
def get(remote: str, local: str, preserve_mode: bool = True) -> Result:
    # http://docs.fabfile.org/en/2.5/api/transfer.html#fabric.transfer.Transfer.get
    t = Transfer(global_context.conn)
    return t.get(remote=remote, local=local, preserve_mode=preserve_mode)