Fix last_backup broken link detection

This commit is contained in:
daniele 2023-04-30 11:32:35 +02:00
parent e45ae1b1b6
commit 0dde6b8df9
Signed by: fuxino
GPG Key ID: 981A2B2A3BBF5514

View File

@ -148,7 +148,12 @@ class Backup:
try:
self._last_backup = os.readlink(f'{self.output}/simple_backup/last_backup')
except Exception:
logger.error('Previous backup could not be read')
logger.warning('Previous backup could not be read')
else:
logger.info('No previous backups available')
if not os.path.isdir(self._last_backup):
logger.warning('Previous backup could not be read')
# Function to read configuration file
@timing(logger)
@ -282,6 +287,8 @@ def simple_backup():
else:
backup_options = '-arvh -H -X'
output = os.path.abspath(output)
backup = Backup(inputs, output, exclude, keep, backup_options)
if backup.check_params():