feat: backup each container with its own path

This commit is contained in:
Silthus 2020-11-16 12:52:59 +01:00
parent dc42418bf7
commit 230445783a
1 changed files with 12 additions and 10 deletions

View File

@ -205,17 +205,19 @@ def start_backup_process(config, containers):
exit(1)
if has_volumes:
try:
logger.info('Backing up volumes')
vol_result = restic.backup_files(config.repository, source='/volumes')
logger.debug('Volume backup exit code: %s', vol_result)
if vol_result != 0:
logger.error('Volume backup exited with non-zero code: %s', vol_result)
logger.info('Backing up volumes')
for volume in [f.path for f in os.scandir('/volumes') if f.is_dir()]:
try:
logger.info('Backing up %s', volume)
vol_result = restic.backup_files(config.repository, source=volume)
logger.debug('Volume backup exit code: %s', vol_result)
if vol_result != 0:
logger.error('Volume backup exited with non-zero code: %s', vol_result)
errors = True
except Exception as ex:
logger.error('Exception raised during volume backup')
logger.exception(ex)
errors = True
except Exception as ex:
logger.error('Exception raised during volume backup')
logger.exception(ex)
errors = True
# back up databases
logger.info('Backing up databases')