More logging cleanup
This commit is contained in:
parent
00cf68fa3e
commit
bdf2ea5e41
|
@ -63,13 +63,11 @@ def backup(config, containers):
|
||||||
if containers.backup_process_running:
|
if containers.backup_process_running:
|
||||||
raise ValueError("Backup process already running")
|
raise ValueError("Backup process already running")
|
||||||
|
|
||||||
logger.info("Initializing repository")
|
logger.info("Initializing repository (may fail if already initalized)")
|
||||||
|
|
||||||
# TODO: Errors when repo already exists
|
# TODO: Errors when repo already exists
|
||||||
restic.init_repo(config.repository)
|
restic.init_repo(config.repository)
|
||||||
|
|
||||||
logger.info("Starting backup container..")
|
|
||||||
|
|
||||||
# Map all volumes from the backup container into the backup process container
|
# Map all volumes from the backup container into the backup process container
|
||||||
volumes = containers.this_container.volumes
|
volumes = containers.this_container.volumes
|
||||||
|
|
||||||
|
@ -106,8 +104,11 @@ def start_backup_process(config, containers):
|
||||||
|
|
||||||
# Back up volumes
|
# Back up volumes
|
||||||
try:
|
try:
|
||||||
|
logger.info('Backing up volumes')
|
||||||
vol_result = restic.backup_files(config.repository, source='/backup')
|
vol_result = restic.backup_files(config.repository, source='/backup')
|
||||||
logger.info('Volume backup exit code: %s', vol_result)
|
logger.debug('Volume backup exit code: %s', vol_result)
|
||||||
|
if vol_result != 0:
|
||||||
|
logger.error('Backup command exited with non-zero code: %s', vol_result)
|
||||||
# TODO: Alert
|
# TODO: Alert
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.error(ex)
|
logger.error(ex)
|
||||||
|
@ -120,7 +121,9 @@ def start_backup_process(config, containers):
|
||||||
instance = container.instance
|
instance = container.instance
|
||||||
logger.info('Backing up %s in service %s', instance.container_type, instance.service_name)
|
logger.info('Backing up %s in service %s', instance.container_type, instance.service_name)
|
||||||
result = instance.backup()
|
result = instance.backup()
|
||||||
logger.info('Exit code: %s', result)
|
logger.debug('Exit code: %s', result)
|
||||||
|
if result != 0:
|
||||||
|
logger.error('Backup command exited with non-zero code: %s', result)
|
||||||
# TODO: Alert
|
# TODO: Alert
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.error(ex)
|
logger.error(ex)
|
||||||
|
|
Loading…
Reference in New Issue