From 91a8fd3b56efa2f327f031786598356db427f5ec Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 4 Jan 2024 13:55:08 +0100 Subject: [PATCH] [system] A more robust logic to parse cache size from `cpuinfo`. --- platypush/schemas/system/_cpu/_base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platypush/schemas/system/_cpu/_base.py b/platypush/schemas/system/_cpu/_base.py index c1bbf78bdd..e5ab02794f 100644 --- a/platypush/schemas/system/_cpu/_base.py +++ b/platypush/schemas/system/_cpu/_base.py @@ -18,8 +18,12 @@ class CpuInfoBaseSchema(SystemBaseSchema): for key, value in data.items(): if key.endswith("_cache_size") and isinstance(value, str): - value, unit = value.split(" ") - value = int(value) + tokens = value.split(" ") + unit = None + if len(tokens) > 1: + unit = tokens[1] + + value = int(tokens[0]) if unit == "KiB": value *= 1024 elif unit == "MiB":