Strip partition numbers from device paths
This commit is contained in:
@ -285,10 +285,13 @@ class SystemHealthMonitor:
|
|||||||
:param device_path: Path to the device
|
:param device_path: Path to the device
|
||||||
:return: Boolean indicating if it's a relevant physical disk
|
: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']
|
excluded_mounts = ['/boot', '/boot/efi']
|
||||||
if any(device_path.startswith(mount) for mount in excluded_mounts):
|
if any(device_path.startswith(mount) for mount in excluded_mounts):
|
||||||
return False
|
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]:
|
def _check_smart_health(self, device: str) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user