rename 'settings' to 'config'
This commit is contained in:
parent
da62c027a7
commit
ff585d4b0c
16
backup.py
16
backup.py
|
|
@ -18,13 +18,13 @@ def backup():
|
||||||
# Set flags
|
# Set flags
|
||||||
utils.set_flags(sys.argv)
|
utils.set_flags(sys.argv)
|
||||||
|
|
||||||
# Load settings
|
# Load configuration
|
||||||
settings = Path(__file__).parent / "settings.yaml"
|
config = Path(__file__).parent / "config.yaml"
|
||||||
with open(settings) as file:
|
with open(config) as file:
|
||||||
# Load settings
|
# Load config
|
||||||
settings_list = yaml.full_load(file)
|
config_list = yaml.full_load(file)
|
||||||
log = Log(settings_list['log']['log_dir'])
|
log = Log(config_list['log']['log_dir'])
|
||||||
containers = Container.instantiate_containers(settings_list)
|
containers = Container.instantiate_containers(config_list)
|
||||||
|
|
||||||
# If any container names were passed as parameters, do only back up them
|
# 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}
|
containers_wanted = {name: container for name, container in containers.items() if name in sys.argv}
|
||||||
|
|
@ -59,7 +59,7 @@ def backup():
|
||||||
backup_status = False
|
backup_status = False
|
||||||
|
|
||||||
# Log backup
|
# 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:
|
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:
|
||||||
|
|
|
||||||
18
restore.py
18
restore.py
|
|
@ -16,13 +16,13 @@ def restore():
|
||||||
# Set flags
|
# Set flags
|
||||||
utils.set_flags(sys.argv)
|
utils.set_flags(sys.argv)
|
||||||
|
|
||||||
# Load settings
|
# Load config
|
||||||
settings = Path(__file__).parent / "settings.yaml"
|
config = Path(__file__).parent / "config.yaml"
|
||||||
with open(settings) as file:
|
with open(config) as file:
|
||||||
# Load settings
|
# Load config
|
||||||
settings_list = yaml.full_load(file)
|
config_list = yaml.full_load(file)
|
||||||
log = Log(settings_list['log']['log_dir'])
|
log = Log(config_list['log']['log_dir'])
|
||||||
containers = Container.instantiate_containers(settings_list)
|
containers = Container.instantiate_containers(config_list)
|
||||||
|
|
||||||
# If any container names were passed as parameters, do only restore them
|
# 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}
|
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
|
# Print result and log
|
||||||
if result:
|
if result:
|
||||||
_print(F"{Fore.GREEN}Backup {container.restore_tar_file} for {container.name} successfully restored.{Style.RESET_ALL}")
|
_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")
|
log.log(F"Restore backup ; {container.name} ; {container.restore_tar_file_path} ; SUCCESS")
|
||||||
else:
|
else:
|
||||||
_print(F"{Fore.RED}Could not restore {container.restore_tar_file} for {container.name}.{Style.RESET_ALL}")
|
_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(F"{Fore.YELLOW}Exception occurred in method: Container.{func}(){Style.RESET_ALL}")
|
||||||
_print(traceback)
|
_print(traceback)
|
||||||
_print()
|
_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")
|
log.log(F"Restore backup ; {container.name} ; {container.restore_tar_file_path} ; FAIL")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
16
upgrade.py
16
upgrade.py
|
|
@ -19,13 +19,13 @@ def upgrade():
|
||||||
# Set flags
|
# Set flags
|
||||||
utils.set_flags(sys.argv)
|
utils.set_flags(sys.argv)
|
||||||
|
|
||||||
# Load settings
|
# Load config
|
||||||
settings = Path(__file__).parent / "settings.yaml"
|
config = Path(__file__).parent / "config.yaml"
|
||||||
with open(settings) as file:
|
with open(config) as file:
|
||||||
# Load settings
|
# Load config
|
||||||
settings_list = yaml.full_load(file)
|
config_list = yaml.full_load(file)
|
||||||
log = Log(settings_list['log']['log_dir'])
|
log = Log(config_list['log']['log_dir'])
|
||||||
containers = Container.instantiate_containers(settings_list)
|
containers = Container.instantiate_containers(config_list)
|
||||||
|
|
||||||
# If any container names were passed as parameters, do only upgrade them
|
# 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}
|
containers_wanted = {name: container for name, container in containers.items() if name in sys.argv}
|
||||||
|
|
@ -68,7 +68,7 @@ def upgrade():
|
||||||
_print(traceback)
|
_print(traceback)
|
||||||
_print()
|
_print()
|
||||||
# Log upgrade
|
# 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:
|
if upgrade_status:
|
||||||
log.log(F"Upgrade ; {container.name} ; SUCCESS")
|
log.log(F"Upgrade ; {container.name} ; SUCCESS")
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue