|
|
|
@ -0,0 +1,19 @@ |
|
|
|
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.tar.gz" |
|
|
|
cmdline.append(remote_dest) |
|
|
|
exec_remote(cmdline) |
|
|
|
return remote_dest |
|
|
|
|
|
|
|
|
|
|
|
def retrieve_backup_on_remote(client: SSHClient, src: Path, dest: Path): |
|
|
|
sftp_client = client.open_sftp() |
|
|
|
sftp_client.get(src, dest) |
|
|
|
sftp_client.remove(src) |