From 6d6d1e20b11ae77a84afd0e9cc1541a5cfb0785c Mon Sep 17 00:00:00 2001 From: brent s Date: Sun, 2 Jun 2019 01:46:23 -0400 Subject: [PATCH] forgot to handle if no snapshots are found --- storage/backups/borg/backup.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/storage/backups/borg/backup.py b/storage/backups/borg/backup.py index eda2ed0..2d7bd3b 100755 --- a/storage/backups/borg/backup.py +++ b/storage/backups/borg/backup.py @@ -544,11 +544,15 @@ class Backup(object): _stderr)) if not self.args['archive']: if self.args['numlimit'] > 0: - if self.args['old']: - output[server][repo['name']] = output[server][repo['name']][:self.args['numlimit']] - else: - output[server][repo['name']] = list(reversed( + try: + if self.args['old']: + output[server][repo['name']] = output[server][repo['name']][:self.args['numlimit']] + else: + output[server][repo['name']] = list( + reversed( output[server][repo['name']]))[:self.args['numlimit']] + except KeyError: + print('(No archives/snapshots found)') if self.args['invert']: output[server][repo['name']] = reversed(output[server][repo['name']]) self.logger.debug('END: lister')