apk facts¶
- class reemote.facts.apk.get_packages.Get_packages[source]¶
Bases:
objectReturns a dictionary of installed packages.
Examples:
yield Get_packages()
- reemote.facts.apk.get_packages.parse_apk_list_installed(output)[source]¶
Parses the raw output of ‘apk info -v’ into a structured list.
This function processes a multi-line string, where each line represents an installed Alpine Linux package in the format ‘name-version-release’. It is designed to correctly separate the package name from its version, even when the name itself contains hyphens.
The primary parsing strategy splits each line based on the last two hyphens to isolate the version and release number. A fallback mechanism is included for edge cases.
- Parameters:
output (str) – The raw string output from the ‘apk info -v’ command.
- Returns:
- A list of dictionaries, where each dictionary contains the
’name’ and ‘version’ of an installed package.
- Return type:
list[dict]
- class reemote.facts.apk.info.Info(package: str, sudo: bool = False, su: bool = False)[source]¶
Bases:
objectA class to manage package operations on a remote system using apk.
This class constructs commands to retrieve information about a specific package on an Alpine Linux system.
- package¶
A package name to be queried.
- Type:
str
- sudo¶
If True, the commands will be executed with sudo privileges.
- Type:
bool
- su¶
If True, the commands will be executed with su privileges.
- Type:
bool
Examples:
yield Info(package='vim')
- Usage:
This class is designed to be used in a generator-based workflow where commands are yielded for execution.
Notes
Commands are constructed based on the package, sudo, and su attributes.