From eb292e3017a0c81a6a5957b0f08f55565615a70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Tue, 17 Oct 2023 20:45:54 +0200 Subject: [PATCH] test: fix if the kernel does not meet our assumption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In get_host_os, if there are not enough components, return None. Signed-off-by: Pablo Barbáchano --- tests/framework/properties.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/framework/properties.py b/tests/framework/properties.py index 036d3743b42..f7ae4b8b3ff 100644 --- a/tests/framework/properties.py +++ b/tests/framework/properties.py @@ -47,6 +47,8 @@ def get_host_os(kv: str = None): if kv is None: kv = platform.release() parts = kv.split("-") + if len(parts) < 2: + return None misc = parts[1].split(".") if len(misc) > 2 and misc[2] in {"amzn2", "amzn2023"}: return misc[2]