Prevent crash when testing some NVMe disks

This commit is contained in:
2Shirt 2019-01-15 18:56:29 -07:00
parent 814ada0ac0
commit 7c7d8e41e2
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -430,9 +430,17 @@ class DiskObj():
# Check for attributes
if KEY_NVME in self.smartctl:
self.nvme_attributes = {
k: {'name': k, 'raw': int(v), 'raw_str': str(v)}
for k, v in self.smartctl[KEY_NVME].items()}
self.nvme_attributes = {}
for k, v in self.smartctl[KEY_NVME].items():
try:
self.nvme_attributes[k] = {
'name': k,
'raw': int(v),
'raw_str': str(v),
}
except Exception:
# TODO: Limit this check
pass
elif KEY_SMART in self.smartctl:
for a in self.smartctl[KEY_SMART].get('table', {}):
try: