forked from coop-cloud/backup-bot-two
fix(snapshots): warn if no snapshots could be found
This commit is contained in:
parent
8e76ad591e
commit
8750ec1813
@ -179,9 +179,16 @@ def restore(snapshot, target, noninteractive):
|
|||||||
@cli.command()
|
@cli.command()
|
||||||
def snapshots():
|
def snapshots():
|
||||||
snapshots = restic.snapshots()
|
snapshots = restic.snapshots()
|
||||||
|
no_snapshots = True
|
||||||
for snap in snapshots:
|
for snap in snapshots:
|
||||||
if not SERVICE or (tags := snap.get('tags')) and SERVICE in tags:
|
if not SERVICE or (tags := snap.get('tags')) and SERVICE in tags:
|
||||||
print(snap['time'], snap['id'])
|
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()
|
@cli.command()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user