Improved method to avoid crash during self-tests

This commit is contained in:
2Shirt 2020-01-30 13:28:52 -07:00
parent dc6dcfb845
commit 385b2158fd
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -497,11 +497,11 @@ class Disk(BaseObj):
_f.write(f'{header_str}\nSMART self-test status:\n {status_str}')
# Check if finished
if 'remaining_percent' not in test_details['status']:
if 'remaining_percent' not in test_details.get('status', {}):
finished = True
break
elif 'remaining_percent' in test_details['status']:
elif 'remaining_percent' in test_details.get('status', {}):
started = True
# Check result