|
|
@ -4,7 +4,6 @@ import pathlib |
|
|
|
import subprocess |
|
|
|
import subprocess |
|
|
|
|
|
|
|
|
|
|
|
from copy_snapshots_to_remote import get_member_name |
|
|
|
from copy_snapshots_to_remote import get_member_name |
|
|
|
from create_snapshot_backup import call, remote_call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SSH_KEY_FILE = "/mnt/Datenspeicher/snap-backup-dataset/backup_key" |
|
|
|
SSH_KEY_FILE = "/mnt/Datenspeicher/snap-backup-dataset/backup_key" |
|
|
|
SSH_REMOTE = "zfs_snap_backup@etha.cpi.imtek.uni-freiburg.de" |
|
|
|
SSH_REMOTE = "zfs_snap_backup@etha.cpi.imtek.uni-freiburg.de" |
|
|
@ -17,6 +16,20 @@ ZFS_ELAB_PREFIX = "elabfs-" |
|
|
|
TMP_BACKUP_FOLDER = "/mnt/Datenspeicher/snap-backup-dataset/temporary-backups" |
|
|
|
TMP_BACKUP_FOLDER = "/mnt/Datenspeicher/snap-backup-dataset/temporary-backups" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def remote_call(arguments): |
|
|
|
|
|
|
|
""" makes runs an command on the remote backup server |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:params arguments: list of command line arguments and parameters |
|
|
|
|
|
|
|
:returns: string of the command output |
|
|
|
|
|
|
|
:raises subprocess.CalledProcessError: if command has not an exit value of 0 |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
cmd = ["ssh", "-i", SSH_KEY_FILE, SSH_REMOTE] |
|
|
|
|
|
|
|
cmd.extend(arguments) |
|
|
|
|
|
|
|
result = subprocess.run(" ".join(cmd), as_text=True, check=True, |
|
|
|
|
|
|
|
stdout=subprocess.PIPE, |
|
|
|
|
|
|
|
universal_newlines=as_text, shell=True) |
|
|
|
|
|
|
|
return result.stdout |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_local_backup_members(): |
|
|
|
def get_local_backup_members(): |
|
|
|
tmp_folder = pathlib.Path(TMP_BACKUP_FOLDER) |
|
|
|
tmp_folder = pathlib.Path(TMP_BACKUP_FOLDER) |
|
|
|