diff --git a/backup.py b/backup.py index 4d32f8d..d57406e 100644 --- a/backup.py +++ b/backup.py @@ -18,13 +18,13 @@ def backup(): # Set flags utils.set_flags(sys.argv) - # Load settings - settings = Path(__file__).parent / "settings.yaml" - with open(settings) as file: - # Load settings - settings_list = yaml.full_load(file) - log = Log(settings_list['log']['log_dir']) - containers = Container.instantiate_containers(settings_list) + # Load configuration + config = Path(__file__).parent / "config.yaml" + with open(config) as file: + # Load config + config_list = yaml.full_load(file) + log = Log(config_list['log']['log_dir']) + containers = Container.instantiate_containers(config_list) # If any container names were passed as parameters, do only back up them containers_wanted = {name: container for name, container in containers.items() if name in sys.argv} @@ -59,7 +59,7 @@ def backup(): backup_status = False # Log backup - if not utils.no_log and settings_list['log']['logging']: + if not utils.no_log and config_list['log']['logging']: if backup_status: log.log(F"Created a backup ; {container.name} ; {container.tar_gz_file_path} ; {result} MB") else: diff --git a/example_settings.yml b/example_config.yml similarity index 100% rename from example_settings.yml rename to example_config.yml diff --git a/restore.py b/restore.py index e30123b..1f14d50 100644 --- a/restore.py +++ b/restore.py @@ -16,13 +16,13 @@ def restore(): # Set flags utils.set_flags(sys.argv) - # Load settings - settings = Path(__file__).parent / "settings.yaml" - with open(settings) as file: - # Load settings - settings_list = yaml.full_load(file) - log = Log(settings_list['log']['log_dir']) - containers = Container.instantiate_containers(settings_list) + # Load config + config = Path(__file__).parent / "config.yaml" + with open(config) as file: + # Load config + config_list = yaml.full_load(file) + log = Log(config_list['log']['log_dir']) + containers = Container.instantiate_containers(config_list) # If any container names were passed as parameters, do only restore them containers_wanted = {name: container for name, container in containers.items() if name in sys.argv} @@ -75,7 +75,7 @@ def restore(): # Print result and log if result: _print(F"{Fore.GREEN}Backup {container.restore_tar_file} for {container.name} successfully restored.{Style.RESET_ALL}") - if not utils.no_log and settings_list['log']['logging']: + if not utils.no_log and config_list['log']['logging']: log.log(F"Restore backup ; {container.name} ; {container.restore_tar_file_path} ; SUCCESS") else: _print(F"{Fore.RED}Could not restore {container.restore_tar_file} for {container.name}.{Style.RESET_ALL}") @@ -84,7 +84,7 @@ def restore(): _print(F"{Fore.YELLOW}Exception occurred in method: Container.{func}(){Style.RESET_ALL}") _print(traceback) _print() - if not utils.no_log and settings_list['log']['logging']: + if not utils.no_log and config_list['log']['logging']: log.log(F"Restore backup ; {container.name} ; {container.restore_tar_file_path} ; FAIL") diff --git a/upgrade.py b/upgrade.py index 13b3608..5778573 100644 --- a/upgrade.py +++ b/upgrade.py @@ -19,13 +19,13 @@ def upgrade(): # Set flags utils.set_flags(sys.argv) - # Load settings - settings = Path(__file__).parent / "settings.yaml" - with open(settings) as file: - # Load settings - settings_list = yaml.full_load(file) - log = Log(settings_list['log']['log_dir']) - containers = Container.instantiate_containers(settings_list) + # Load config + config = Path(__file__).parent / "config.yaml" + with open(config) as file: + # Load config + config_list = yaml.full_load(file) + log = Log(config_list['log']['log_dir']) + containers = Container.instantiate_containers(config_list) # If any container names were passed as parameters, do only upgrade them containers_wanted = {name: container for name, container in containers.items() if name in sys.argv} @@ -68,7 +68,7 @@ def upgrade(): _print(traceback) _print() # Log upgrade - if not utils.no_log and settings_list['log']['logging']: + if not utils.no_log and config_list['log']['logging']: if upgrade_status: log.log(F"Upgrade ; {container.name} ; SUCCESS") else: