yum facts

class reemote.facts.yum.get_packages.Get_packages[source]

Bases: object

Returns a dictionary of installed packages.

Examples:

yield Get_packages()
reemote.facts.yum.get_packages.parse_dnf_list_installed(output)[source]

Parses the output of ‘dnf list installed’ into a structured list.

This function processes the raw string output from commands like dnf list installed or yum list installed. It extracts the package name and version for each entry, producing a clean, structured list.

Key transformations include:

  • Skipping header lines (e.g., “Installed Packages”) and empty lines.

  • Handling package names that may contain spaces.

  • Identifying the version by locating the repository field, which starts with an ‘@’ symbol, to reliably separate it from the name.

  • Assembling a list of dictionaries, each with ‘name’ and ‘version’ keys.

Parameters:

output (str) – The raw standard output from the dnf/yum command.

Returns:

A list of dictionaries, where each dictionary represents

an installed package and contains ‘name’ and ‘version’ keys.

Return type:

list[dict]