From a9f916f3ef01a1ea5464d1b6345b0ed7156c3453 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem <4048546+olehermanse@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:17:11 +0100 Subject: [PATCH] When failing to detect platform, inventory attribute "OS" now defaults to PRETTY_NAME from os-release as a fallback This is only a fallback / last resort, in the case where the C code puts "Unknown" into the sys.os_name_human variable. Also adding a warning to the agent in this case: https://github.com/cfengine/core/pull/5460 Ticket: CFE-4342 Changelog: Title Signed-off-by: Ole Herman Schumacher Elgesem --- inventory/os.cf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inventory/os.cf b/inventory/os.cf index e1f653746..22d81e0f3 100644 --- a/inventory/os.cf +++ b/inventory/os.cf @@ -130,5 +130,14 @@ amzn_2:: string => "Amazon 2", meta => { "inventory", "attribute_name=OS" }; +any:: + "description" + string => "$(sys.os_release[PRETTY_NAME])", + if => and( + strcmp("$(sys.os_name_human)", "Unknown"), + isvariable("sys.os_release[PRETTY_NAME]") + ), + meta => { "inventory", "attribute_name=OS", "derived-from=sys.os_release" }; + @endif }