From deafd5b629fcd346eb13a6253d601cfcaa0da146 Mon Sep 17 00:00:00 2001 From: Ricardo Bartels Date: Fri, 21 Mar 2025 07:39:55 +0100 Subject: [PATCH] fixes issue with retrieving platform name for newer guest tools #448 --- module/sources/vmware/connection.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/module/sources/vmware/connection.py b/module/sources/vmware/connection.py index 9ab8974..1b3be80 100644 --- a/module/sources/vmware/connection.py +++ b/module/sources/vmware/connection.py @@ -2180,10 +2180,13 @@ class VMWareHandler(SourceBase): platform = get_string_or_none(grab(obj, "guest.guestFullName", fallback=platform)) # extract prettyName from extraConfig exposed by guest tools - extra_config = [x.value for x in grab(obj, "config.extraConfig", fallback=[]) - if x.key == "guestOS.detailed.data"] - if len(extra_config) > 0: - pretty_name = [x for x in quoted_split(extra_config[0].replace("' ", "', ")) if x.startswith("prettyName")] + extra_config = {x.key: x.value for x in grab(obj, "config.extraConfig", fallback=[]) + if x.key in ["guestOS.detailed.data", "guestInfo.detailed.data"]} + + # first try 'guestInfo.detailed.data' and then 'guestOS.detailed.data' + detailed_data = extra_config.get("guestInfo.detailed.data") or extra_config.get("guestOS.detailed.data") + if isinstance(detailed_data, str): + pretty_name = [x for x in quoted_split(detailed_data.replace("' ", "', ")) if x.startswith("prettyName")] if len(pretty_name) > 0: platform = pretty_name[0].replace("prettyName='","")