From 3cd83dfb495d4143f0aaecbfd02799673524c9d9 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 12 Aug 2019 11:35:12 +0200 Subject: [PATCH] remote calls show stderr --- compare_checksums.py | 4 ++-- create_snapshot_backup.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compare_checksums.py b/compare_checksums.py index cd34135..ece1196 100644 --- a/compare_checksums.py +++ b/compare_checksums.py @@ -21,13 +21,13 @@ TMP_BACKUP_FOLDER = "/mnt/Datenspeicher/snap-backup-dataset/temporary-backups" def get_local_backup_members(): tmp_folder = pathlib.Path(TMP_BACKUP_FOLDER) backups = (i for i in tmp_folder.iterdir() if i.suffix==".gz") - return (get_member_name(b) for b in backups) + return (get_member_name(b.name) for b in backups) def get_remote_checksums(): result = {} for member in get_local_backup_members(): - remote_path = f"{REMOTE_PATH}/{member}" + remote_path = f"{REMOTE_PATH}/{member}/\*" cmd_result = remote_call(["sha256sum", remote_path]) print(cmd_result) diff --git a/create_snapshot_backup.py b/create_snapshot_backup.py index 11f1406..7b34caf 100755 --- a/create_snapshot_backup.py +++ b/create_snapshot_backup.py @@ -46,7 +46,11 @@ def remote_call(arguments): """ cmd = ["ssh", "-i", SSH_KEY_FILE, SSH_REMOTE] cmd.extend(arguments) - return call(cmd, as_text=True) + try: + result = call(cmd, as_text=True) + except CalledProcessError as e: + print("STDERR:", e.stderr) + raise def clean_split(text):