Added first run flag to clone settings
* If the loaded settings are for a non-attempted recovery discard settings
This commit is contained in:
parent
67bb9223aa
commit
4c50a1fb8a
1 changed files with 31 additions and 11 deletions
|
|
@ -34,6 +34,7 @@ Options:
|
||||||
CLONE_SETTINGS = {
|
CLONE_SETTINGS = {
|
||||||
'Source': None,
|
'Source': None,
|
||||||
'Destination': None,
|
'Destination': None,
|
||||||
|
'First Run': True,
|
||||||
'Needs Format': False,
|
'Needs Format': False,
|
||||||
'Table Type': None,
|
'Table Type': None,
|
||||||
'Partition Mapping': [
|
'Partition Mapping': [
|
||||||
|
|
@ -174,16 +175,20 @@ class State():
|
||||||
def _check_settings(settings):
|
def _check_settings(settings):
|
||||||
"""Check settings for issues and update as necessary."""
|
"""Check settings for issues and update as necessary."""
|
||||||
if settings:
|
if settings:
|
||||||
bail = False
|
if settings['First Run']:
|
||||||
for key in ('model', 'serial'):
|
# Previous run aborted before starting recovery, settings discarded
|
||||||
if settings['Source'][key] != self.source.details[key]:
|
settings = {}
|
||||||
std.print_error(f"Clone settings don't match source {key}")
|
else:
|
||||||
bail = True
|
bail = False
|
||||||
if settings['Destination'][key] != self.destination.details[key]:
|
for key in ('model', 'serial'):
|
||||||
std.print_error(f"Clone settings don't match destination {key}")
|
if settings['Source'][key] != self.source.details[key]:
|
||||||
bail = True
|
std.print_error(f"Clone settings don't match source {key}")
|
||||||
if bail:
|
bail = True
|
||||||
raise std.GenericAbort()
|
if settings['Destination'][key] != self.destination.details[key]:
|
||||||
|
std.print_error(f"Clone settings don't match destination {key}")
|
||||||
|
bail = True
|
||||||
|
if bail:
|
||||||
|
raise std.GenericAbort()
|
||||||
|
|
||||||
# Update settings
|
# Update settings
|
||||||
if not settings:
|
if not settings:
|
||||||
|
|
@ -619,7 +624,22 @@ def build_block_pair_report(block_pairs, settings):
|
||||||
report.append(' ')
|
report.append(' ')
|
||||||
|
|
||||||
# Show resume messages as necessary
|
# Show resume messages as necessary
|
||||||
# TODO If settings --> Add loaded settings msg
|
if settings:
|
||||||
|
if not settings['First Run']:
|
||||||
|
report.append(
|
||||||
|
std.color_string(
|
||||||
|
['NOTE:', 'Clone settings loaded from previous run.'],
|
||||||
|
['BLUE', None],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
if settings['Needs Format'] and settings['Table Type']:
|
||||||
|
msg = f'Destination will be formatted using {settings["Table Type"]}'
|
||||||
|
report.append(
|
||||||
|
std.color_string(
|
||||||
|
['NOTE:', msg],
|
||||||
|
['BLUE', None],
|
||||||
|
),
|
||||||
|
)
|
||||||
# TODO If anything recovered --> Add resume msg
|
# TODO If anything recovered --> Add resume msg
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue