From 960685e7365d0de6b9ccbf4f9c4f3c4478dddaa4 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 7 Aug 2019 14:46:06 +0200 Subject: [PATCH] working on a working version --- zfs-snapshot-backup.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/zfs-snapshot-backup.py b/zfs-snapshot-backup.py index 69cc143..040a18b 100644 --- a/zfs-snapshot-backup.py +++ b/zfs-snapshot-backup.py @@ -96,24 +96,24 @@ def backup_latest_snapshot(member, elab_snapshots, existing_backups): # create the backup print(" - generating temporary backup file") - tmp_gzip_filepath = gzip_filepath(current_snapshot) - with open(tmp_gzip_filepath, "wb") as file_handle: - gzip_in = subprocess.Popen( - "gzip", stdin=subprocess.PIPE, stdout=file_handle, check=True - ).stdin - subprocess.call(send_cmd, stdout=gzip_in, check=True) + #tmp_gzip_filepath = gzip_filepath(current_snapshot) + #with open(tmp_gzip_filepath, "wb") as file_handle: + # gzip_in = subprocess.Popen( + # "gzip", stdin=subprocess.PIPE, stdout=file_handle, check=True + # ).stdin + # subprocess.call(send_cmd, stdout=gzip_in, check=True) # copy the backup to the remote server print(" - copying temporary backup file") - remote_url = ( - f"{SSH_REMOTE}:~/{REMOTE_PATH}/{member}/{tmp_gzip_filepath.name}" - ) - copy_cmd = ["scp", "-i", SSH_KEY_FILE, str(tmp_gzip_filepath), remote_url] - call(copy_cmd) + #remote_url = ( + # f"{SSH_REMOTE}:~/{REMOTE_PATH}/{member}/{tmp_gzip_filepath.name}" + #) + #copy_cmd = ["scp", "-i", SSH_KEY_FILE, str(tmp_gzip_filepath), remote_url] + #call(copy_cmd) # remove the temporary file print(" - removing temporary backup file") - tmp_gzip_filepath.unlink() + #tmp_gzip_filepath.unlink() def create_backups(): @@ -125,5 +125,4 @@ def create_backups(): if __name__ == "__main__": - es = elab_snapshots() - print(list_remote_backups(es.keys())) + create_backups()