Include note if attributes fail mid-diagnostics

This commit is contained in:
2Shirt 2021-04-09 01:38:30 -06:00
parent 812fd15011
commit ce8dddd9b7
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -176,6 +176,13 @@ class State():
if 'Disk Attributes' in disk.tests:
disk.tests['Disk Attributes'].failed = True
disk.tests['Disk Attributes'].set_status('Failed')
if not prep:
# Mid-diag failure detected
LOG.warning('Critical hardware error detected during diagnostics')
disk.add_note(
'Critical hardware error detected during diagnostics',
'YELLOW',
)
except hw_obj.SMARTSelfTestInProgressError as err:
if prep:
std.print_warning(f'SMART self-test(s) in progress for {disk.path}')
@ -198,12 +205,18 @@ class State():
std.color_string('Please manually review SMART data', 'YELLOW'),
)
else:
# No blocking errors encountered, check for minor attribute failures
if ('Disk Attributes' in disk.tests
if (
'Disk Attributes' in disk.tests
and not disk.tests['Disk Attributes'].failed
and not disk.check_attributes(only_blocking=False)):
# Mid-diag failure detected
LOG.warning('Disk attributes failure detected during diagnostics')
# No blocking errors encountered, but found minor attribute failures
if not prep:
# Mid-diag failure detected
LOG.warning('Attribute(s) failure detected during diagnostics')
disk.add_note(
'Attribute(s) failure detected during diagnostics',
'YELLOW',
)
disk.tests['Disk Attributes'].failed = True
disk.tests['Disk Attributes'].set_status('Failed')