fix(snapshots): warn if no snapshots could be found
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Moritz 2023-10-12 10:34:10 +02:00
parent 8e76ad591e
commit 8750ec1813
1 changed files with 7 additions and 0 deletions

View File

@ -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()