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)
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)}
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)