Fix smart_supported: treat null smart_support as unsupported
This commit is contained in:
@@ -73,8 +73,8 @@ async def _run_smartctl(device: str) -> dict:
|
|||||||
|
|
||||||
def _parse_smart_json(device: str, data: dict) -> dict:
|
def _parse_smart_json(device: str, data: dict) -> dict:
|
||||||
"""Extract relevant fields from smartctl JSON output."""
|
"""Extract relevant fields from smartctl JSON output."""
|
||||||
smart_support = data.get("smart_support", {})
|
smart_support = data.get("smart_support")
|
||||||
is_supported = smart_support.get("available", True) if smart_support else True
|
is_supported = smart_support.get("available", True) if isinstance(smart_support, dict) else False
|
||||||
result: dict = {"device": device, "smart_supported": is_supported}
|
result: dict = {"device": device, "smart_supported": is_supported}
|
||||||
|
|
||||||
# Identity — ATA vs SCSI field names
|
# Identity — ATA vs SCSI field names
|
||||||
|
|||||||
Reference in New Issue
Block a user