Browse Source

remote calls show stderr

master
Holger Frey 5 years ago
parent
commit
3cd83dfb49
  1. 4
      compare_checksums.py
  2. 6
      create_snapshot_backup.py

4
compare_checksums.py

@ -21,13 +21,13 @@ TMP_BACKUP_FOLDER = "/mnt/Datenspeicher/snap-backup-dataset/temporary-backups"
def get_local_backup_members(): def get_local_backup_members():
tmp_folder = pathlib.Path(TMP_BACKUP_FOLDER) tmp_folder = pathlib.Path(TMP_BACKUP_FOLDER)
backups = (i for i in tmp_folder.iterdir() if i.suffix==".gz") 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(): def get_remote_checksums():
result = {} result = {}
for member in get_local_backup_members(): 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]) cmd_result = remote_call(["sha256sum", remote_path])
print(cmd_result) print(cmd_result)

6
create_snapshot_backup.py

@ -46,7 +46,11 @@ def remote_call(arguments):
""" """
cmd = ["ssh", "-i", SSH_KEY_FILE, SSH_REMOTE] cmd = ["ssh", "-i", SSH_KEY_FILE, SSH_REMOTE]
cmd.extend(arguments) 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): def clean_split(text):

Loading…
Cancel
Save