Some devices have null pages in their ata_device_statistics struct; skip
those pages in order to avoid an AttributeError when extracting device's
wear level.
Fixes: https://tracker.ceph.com/issues/51554
Signed-off-by: Yaarit Hatuka <yaarit@redhat.com>
(cherry picked from commit
2864ac30d4170ba7b5f60ae01ecfdeee707e026a)
Extract wear level (as float) from smartctl -x --json output for SATA SSD
"""
for page in data.get("ata_device_statistics", {}).get("pages", []):
- if page.get("number") != 7:
+ if page is None or page.get("number") != 7:
continue
for item in page.get("table", []):
if item["offset"] == 8: