Skip to content

Commit

Permalink
When failing to detect platform, inventory attribute "OS" now default…
Browse files Browse the repository at this point in the history
…s 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:

cfengine/core#5460

Ticket: CFE-4342
Changelog: Title
Signed-off-by: Ole Herman Schumacher Elgesem <[email protected]>
(cherry picked from commit a9f916f)
  • Loading branch information
olehermanse committed May 27, 2024
1 parent d093652 commit e28c450
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions inventory/os.cf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit e28c450

Please sign in to comment.