Updated lxc file system matching

This commit is contained in:
2025-05-12 15:41:01 -04:00
parent 4fe0a8dbfc
commit 20f51e0b25

View File

@ -790,6 +790,10 @@ class SystemHealthMonitor:
try:
# Skip non-size strings
if not isinstance(size_str, str):
logger.debug(f"Not a string: {size_str}")
return 0.0
if not any(unit in size_str.upper() for unit in ['B', 'K', 'M', 'G', 'T']):
logger.debug(f"No valid size unit found in: {size_str}")
return 0.0
@ -804,8 +808,8 @@ class SystemHealthMonitor:
}
# Extract numeric value and unit
value = float(size_str[:-1].strip())
unit = size_str[-1].upper()
value = float(re.match(r'(\d+\.?\d*)', size_str).group(1))
unit = re.search(r'([BKMGT])', size_str.upper()).group(1)
logger.debug(f"Extracted value: {value}, unit: {unit}")
@ -815,7 +819,7 @@ class SystemHealthMonitor:
return bytes_value
except (ValueError, AttributeError) as e:
except (ValueError, AttributeError, TypeError) as e:
logger.debug(f"Failed to parse size string: {size_str}")
logger.debug(f"Parse error details: {str(e)}")
return 0.0