You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
558 B

from pathlib import Path
from paramiko.client import SSHClient
from utils import exec_remote
def make_backup_on_remote(client: SSHClient, tmp_path: Path):
cmdline = ["sysupgrade", "-b"]
remote_dest = tmp_path / "backup_latest.openwrt_backup.tar.gz"
cmdline.append(remote_dest)
exec_remote(client, cmdline)
return remote_dest
def retrieve_backup_on_remote(client: SSHClient, src: Path, dest: Path):
sftp_client = client.open_sftp()
src, dest = map(str, (src, dest))
sftp_client.get(src, dest)
sftp_client.remove(src)