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.

19 lines
497 B

  1. from pathlib import Path
  2. from paramiko.client import SSHClient
  3. from utils import exec_remote
  4. def make_backup_on_remote(client: SSHClient, tmp_path: Path):
  5. cmdline = ["sysupgrade", "-b"]
  6. remote_dest = tmp_path / "backup_latest.tar.gz"
  7. cmdline.append(remote_dest)
  8. exec_remote(cmdline)
  9. return remote_dest
  10. def retrieve_backup_on_remote(client: SSHClient, src: Path, dest: Path):
  11. sftp_client = client.open_sftp()
  12. sftp_client.get(src, dest)
  13. sftp_client.remove(src)