small changes
This commit is contained in:
parent
3db0116c79
commit
8232fa4adf
25
backup.py
25
backup.py
|
|
@ -29,7 +29,7 @@ def backup():
|
||||||
log = Log(settings_list['log']['log_dir'])
|
log = Log(settings_list['log']['log_dir'])
|
||||||
containers = Container.instantiate_containers(settings_list)
|
containers = Container.instantiate_containers(settings_list)
|
||||||
|
|
||||||
# If any container names where passed as parameters, do only backup them
|
# If any container names were passed as parameters, do only backup them
|
||||||
containers_wanted = {name: container for name, container in containers.items() if name in sys.argv}
|
containers_wanted = {name: container for name, container in containers.items() if name in sys.argv}
|
||||||
if containers_wanted:
|
if containers_wanted:
|
||||||
containers = containers_wanted
|
containers = containers_wanted
|
||||||
|
|
@ -55,18 +55,17 @@ def backup():
|
||||||
backup_status = False
|
backup_status = False
|
||||||
|
|
||||||
# Log backup
|
# Log backup
|
||||||
if not utils.no_log:
|
if not utils.no_log and settings_list['log']['logging']:
|
||||||
if settings_list['log']['logging']:
|
if backup_status:
|
||||||
if backup_status:
|
log.log(F"Created a backup ; {container.name} ; {container.tar_gz_file_path} ; {result} MB")
|
||||||
log.log(F"Created a backup ; {container.name} ; {container.tar_gz_file_path} ; {result} MB")
|
else:
|
||||||
else:
|
log.log(F"Backup for {container.name} failed")
|
||||||
log.log(F"Backup for {container.name} failed")
|
if len(log.exceptions) > 0:
|
||||||
if len(log.exceptions) > 0:
|
for func, traceback in log.exceptions.items():
|
||||||
for func, traceback in log.exceptions.items():
|
_print()
|
||||||
_print()
|
_print(F"{Fore.YELLOW}Exception occurred in method: Log.{func}(){Style.RESET_ALL}")
|
||||||
_print(F"{Fore.YELLOW}Exception occurred in method: Log.{func}(){Style.RESET_ALL}")
|
_print(traceback)
|
||||||
_print(traceback)
|
_print()
|
||||||
_print()
|
|
||||||
|
|
||||||
# Clean up backup folder
|
# Clean up backup folder
|
||||||
if not utils.no_cleanup:
|
if not utils.no_cleanup:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue