Moved check_os_and_abort logic to its own function
This commit is contained in:
parent
e869fc96b0
commit
8ad9e834ef
1 changed files with 14 additions and 9 deletions
|
|
@ -155,6 +155,19 @@ SETUP_QUESTIONS = {
|
|||
|
||||
|
||||
# Functions
|
||||
def check_os_and_abort():
|
||||
"""Check OS and prompt to abort if not supported."""
|
||||
result = try_and_print(
|
||||
message='OS support status...',
|
||||
function=check_os_support_status,
|
||||
cs='GOOD',
|
||||
)
|
||||
if not result['CS'] and 'Unsupported' in result['Error']:
|
||||
print_warning('OS version not supported by this script')
|
||||
if not ask('Continue anyway? (NOT RECOMMENDED)'):
|
||||
abort()
|
||||
|
||||
|
||||
def get_actions(setup_mode, answers):
|
||||
"""Get actions to perform based on setup_mode, returns OrderedDict."""
|
||||
actions = OrderedDict({})
|
||||
|
|
@ -292,15 +305,7 @@ def main():
|
|||
clear_screen()
|
||||
|
||||
# Check installed OS
|
||||
result = try_and_print(
|
||||
message='OS support status...',
|
||||
function=check_os_support_status,
|
||||
cs='GOOD',
|
||||
)
|
||||
if not result['CS'] and 'Unsupported' in result['Error']:
|
||||
print_warning('OS version not supported by this script')
|
||||
if not ask('Continue anyway? (NOT RECOMMENDED)'):
|
||||
abort()
|
||||
check_os_and_abort()
|
||||
|
||||
# Get setup mode
|
||||
setup_mode = get_mode()
|
||||
|
|
|
|||
Loading…
Reference in a new issue