Move detect drives logic to its own function
This commit is contained in:
parent
4550b13565
commit
b3f4a31ed2
1 changed files with 13 additions and 8 deletions
|
|
@ -1532,6 +1532,18 @@ def clean_working_dir(working_dir):
|
|||
shutil.move(entry.path, new_path)
|
||||
|
||||
|
||||
def detect_drives(state):
|
||||
"""Detect connected drives and check source/dest selections."""
|
||||
std.clear_screen()
|
||||
std.print_warning(DETECT_DRIVES_NOTICE)
|
||||
if std.ask('Are you sure you proceed?'):
|
||||
std.print_standard('Forcing controllers to rescan for devices...')
|
||||
cmd = 'echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan'
|
||||
exe.run_program(cmd, check=False, shell=True)
|
||||
if source_or_destination_changed(state):
|
||||
std.abort()
|
||||
|
||||
|
||||
def format_status_string(status, width):
|
||||
"""Format colored status string, returns str."""
|
||||
color = None
|
||||
|
|
@ -1895,14 +1907,7 @@ def main():
|
|||
|
||||
# Detect drives
|
||||
if 'Detect drives' in selection[0]:
|
||||
std.clear_screen()
|
||||
std.print_warning(DETECT_DRIVES_NOTICE)
|
||||
if std.ask('Are you sure you proceed?'):
|
||||
std.print_standard('Forcing controllers to rescan for devices...')
|
||||
cmd = 'echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan'
|
||||
exe.run_program(cmd, check=False, shell=True)
|
||||
if source_or_destination_changed(state):
|
||||
std.abort()
|
||||
detect_drives(state)
|
||||
|
||||
# Start recovery
|
||||
if 'Start' in selection:
|
||||
|
|
|
|||
Loading…
Reference in a new issue