From 8750ec181346bbd36c64a0f3beba0ab8df78fb7c Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 12 Oct 2023 10:34:10 +0200 Subject: [PATCH] fix(snapshots): warn if no snapshots could be found --- backupbot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backupbot.py b/backupbot.py index 148e33d..b87da42 100755 --- a/backupbot.py +++ b/backupbot.py @@ -179,9 +179,16 @@ def restore(snapshot, target, noninteractive): @cli.command() def snapshots(): snapshots = restic.snapshots() + no_snapshots = True for snap in snapshots: if not SERVICE or (tags := snap.get('tags')) and SERVICE in tags: print(snap['time'], snap['id']) + no_snapshots = False + if no_snapshots: + err_msg = "No Snapshots found" + if SERVICE: + err_msg += f' for app {SERVICE}' + logging.warning(err_msg) @cli.command()