Avoid rare crash concerning disk attributes

* Crash would occur under these circumstances:
  * Disk Attributes test was not selected
  * One or more other disk tests were selected
  * A non-blocking attribute error was detected
This commit is contained in:
2Shirt 2020-01-30 13:16:48 -07:00
parent 417241acb5
commit 86f0f1e5fd
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -198,7 +198,11 @@ class State():
)
else:
# No blocking errors encountered, check for minor attribute failures
if not disk.check_attributes(only_blocking=False):
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')
disk.tests['Disk Attributes'].failed = True
disk.tests['Disk Attributes'].set_status('Failed')