code cleanup
This commit is contained in:
parent
6b4c72e89b
commit
da62c027a7
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import datetime
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
@ -9,16 +8,10 @@ import utils
|
||||||
from utils import _print
|
from utils import _print
|
||||||
from models import Container
|
from models import Container
|
||||||
from models import Log
|
from models import Log
|
||||||
|
|
||||||
from simple_term_menu import TerminalMenu
|
from simple_term_menu import TerminalMenu
|
||||||
|
|
||||||
|
|
||||||
# terminal_menu = TerminalMenu(["entry 1", "entry 2", "entry 3"])
|
|
||||||
# choice_index = terminal_menu.show()
|
|
||||||
# https://stackoverflow.com/posts/61265356/revisions
|
|
||||||
|
|
||||||
def restore():
|
def restore():
|
||||||
restore_status = True
|
|
||||||
|
|
||||||
# Set flags
|
# Set flags
|
||||||
utils.set_flags(sys.argv)
|
utils.set_flags(sys.argv)
|
||||||
|
|
@ -44,7 +37,6 @@ def restore():
|
||||||
containers = {containers_to_choose_from[choice_index]: containers.get(containers_to_choose_from[choice_index])}
|
containers = {containers_to_choose_from[choice_index]: containers.get(containers_to_choose_from[choice_index])}
|
||||||
|
|
||||||
container: Container
|
container: Container
|
||||||
results = {}
|
|
||||||
for container in containers.values():
|
for container in containers.values():
|
||||||
|
|
||||||
# Start restore
|
# Start restore
|
||||||
|
|
@ -92,7 +84,6 @@ 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()
|
||||||
backup_status = False
|
|
||||||
if not utils.no_log and settings_list['log']['logging']:
|
if not utils.no_log and settings_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")
|
||||||
|
|
||||||
|
|
|
||||||
8
utils.py
8
utils.py
|
|
@ -11,18 +11,18 @@ keep_maintenance_mode = False
|
||||||
|
|
||||||
|
|
||||||
def set_flags(flags=list):
|
def set_flags(flags=list):
|
||||||
|
global no_confirm
|
||||||
|
global all_containers
|
||||||
global quiet_mode
|
global quiet_mode
|
||||||
global no_log
|
global no_log
|
||||||
global no_cleanup
|
global no_cleanup
|
||||||
global all_containers
|
|
||||||
global no_confirm
|
|
||||||
global no_backup
|
global no_backup
|
||||||
|
|
||||||
|
no_confirm = "--yes" in flags
|
||||||
|
all_containers = "--all" in flags
|
||||||
quiet_mode = "--quiet" in flags
|
quiet_mode = "--quiet" in flags
|
||||||
no_log = "--nolog" in flags
|
no_log = "--nolog" in flags
|
||||||
all_containers = "--all" in flags
|
|
||||||
no_cleanup = "--nocleanup" in flags
|
no_cleanup = "--nocleanup" in flags
|
||||||
no_confirm = "--yes" in flags
|
|
||||||
no_backup = "--nobackup" in flags
|
no_backup = "--nobackup" in flags
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue