From ce8dddd9b74e76e133cb597b1a18f752d8f650e4 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Fri, 9 Apr 2021 01:38:30 -0600 Subject: [PATCH] Include note if attributes fail mid-diagnostics --- scripts/wk/hw/diags.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/wk/hw/diags.py b/scripts/wk/hw/diags.py index 09ccfe47..e6ce5540 100644 --- a/scripts/wk/hw/diags.py +++ b/scripts/wk/hw/diags.py @@ -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')