Strip partition numbers from device paths

This commit is contained in:
2025-02-27 21:53:59 -05:00
parent 2ddcc21519
commit d45e866b63

View File

@ -285,10 +285,13 @@ class SystemHealthMonitor:
:param device_path: Path to the device
:return: Boolean indicating if it's a relevant physical disk
"""
# Strip partition numbers to get base device
base_device = re.sub(r'\d+$', '', device_path)
excluded_mounts = ['/boot', '/boot/efi']
if any(device_path.startswith(mount) for mount in excluded_mounts):
return False
return bool(re.match(r'/dev/(sd[a-z]|nvme\d+n\d+|mmcblk\d+)', device_path))
return bool(re.match(r'/dev/(sd[a-z]|nvme\d+n\d+|mmcblk\d+)$', base_device))
def _check_smart_health(self, device: str) -> Dict[str, Any]:
"""