apk operations

class reemote.operations.apk.update.Update(guard: bool = True, sudo: bool = False, su: bool = False)[source]

Bases: Operation_update

A class to manage package update operations on a remote system using apk.

This class provides functionality to update packages on Alpine Linux systems and allows configuration of execution privileges and safety guards.

guard

If False the commands will not be executed.

Type:

bool

sudo

If True, the commands will be executed with [sudo](file:///home/kim/reemote/reemote/command.py#L11-L11) privileges.

Type:

bool

su

If True, the commands will be executed with [su](file:///home/kim/reemote/reemote/command.py#L12-L12) privileges.

Type:

bool

Examples:

# Update packages on all hosts
r = yield Update()
# Check if the operation was successful
if r.cp.return_code == 0:
    print("Packages updated successfully")
Usage:

This class is designed to be used in a generator-based workflow where commands are yielded for execution.

Notes

get_packages()[source]

Retrieve the list of installed packages. Subclasses must implement this method.

update(guard=None, sudo=None, su=None)[source]

Install the specified packages. Subclasses must implement this method.

class reemote.operations.apk.upgrade.Upgrade(guard: bool = True, sudo: bool = False, su: bool = False)[source]

Bases: Operation_upgrade

A class to manage package upgrade operations on a remote system using apk.

This class provides functionality to upgrade packages on Alpine Linux systems and allows configuration of execution privileges and safety guards.

guard

If False the commands will not be executed.

Type:

bool

sudo

If True, the commands will be executed with [sudo](file:///home/kim/reemote/reemote/command.py#L11-L11) privileges.

Type:

bool

su

If True, the commands will be executed with [su](file:///home/kim/reemote/reemote/command.py#L12-L12) privileges.

Type:

bool

Examples:

# Upgrade packages on all hosts
r = yield Upgrade()
# Check if the operation was successful
if r.cp.return_code == 0:
    print("Packages upgraded successfully")
Usage:

This class is designed to be used in a generator-based workflow where commands are yielded for execution.

Notes

get_packages()[source]

Retrieve the list of installed packages. Subclasses must implement this method.

upgrade(guard=None, sudo=None, su=None)[source]

Install the specified packages. Subclasses must implement this method.

class reemote.operations.apk.packages.Packages(packages: List[str], present: bool, guard: bool = True, sudo: bool = False, su: bool = False)[source]

Bases: Operation_packages

A class to manage package operations on a remote system using apk.

Description

This class extends the Operation_packages base class to provide functionality for managing packages on a remote system via the apk package manager. It supports installing, removing, and retrieving package information while allowing fine-grained control over execution privileges (sudo, su) and operational guards.

param packages:

A list of package names to be managed.

type packages:

List[str]

param present:

Indicates whether the packages should be present (True) or absent (False) on the system.

type present:

bool

param guard:

Enables or disables guard conditions for operations. Defaults to True.

type guard:

bool, optional

param sudo:

Executes commands with sudo privileges if True. Defaults to False.

type sudo:

bool, optional

param su:

Executes commands with su privileges if True. Defaults to False.

type su:

bool, optional

get_packages()[source]

Retrieves the list of installed packages on the remote system.

Returns:

An instance of Get_packages containing the package information.

Return type:

Get_packages

install_packages(packages=None, guard=None, present=None, sudo=None, su=None)[source]

Installs the specified packages on the remote system.

Parameters:
  • packages (List[str], optional) – Overrides the default package list for this operation. Defaults to None.

  • guard (bool, optional) – Overrides the default guard condition. Defaults to None.

  • present (bool, optional) – Overrides the default presence condition. Defaults to None.

  • sudo (bool, optional) – Overrides the default sudo setting. Defaults to None.

  • su (bool, optional) – Overrides the default su setting. Defaults to None.

Returns:

An instance of Install configured with the specified parameters.

Return type:

Install

remove_packages(packages=None, guard=None, present=None, sudo=None, su=None)[source]

Removes the specified packages from the remote system.

Parameters:
  • packages (List[str], optional) – Overrides the default package list for this operation. Defaults to None.

  • guard (bool, optional) – Overrides the default guard condition. Defaults to None.

  • present (bool, optional) – Overrides the default presence condition. Defaults to None.

  • sudo (bool, optional) – Overrides the default sudo setting. Defaults to None.

  • su (bool, optional) – Overrides the default su setting. Defaults to None.

Returns:

An instance of Remove configured with the specified parameters.

Return type:

Remove

get_packages()[source]

Retrieve the list of installed packages. Subclasses must implement this method.

install_packages(packages=None, guard=None, present=None, sudo=None, su=None)[source]

Install the specified packages. Subclasses must implement this method.

remove_packages(packages=None, guard=None, present=None, sudo=None, su=None)[source]

Remove the specified packages. Subclasses must implement this method.