pacman operations

class reemote.operations.pacman.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 pacman.

This class provides functionality to update package databases on Arch Linux systems using the pacman package manager. It allows configuration of execution privileges and safety guards for package update operations.

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 package databases on all hosts
r = yield Update()
# Check if the operation was successful
if r.cp.return_code == 0:
    print("Package databases 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_packages(guard=None, sudo=None, su=None)[source]
class reemote.operations.pacman.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 pacman.

This class provides functionality to install or remove packages on Arch Linux systems using the pacman package manager. It allows configuration of execution privileges and safety guards for package operations.

packages

List of package names to install or remove.

Type:

List[str]

present

If True, packages will be installed; if False, packages will be removed.

Type:

bool

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:

# Install packages on all hosts
r = yield Packages(["nginx", "curl"], present=True)
# Check if the operation was successful
if r.cp.return_code == 0:
    print("Packages installed successfully")

# Remove packages on all hosts
r = yield Packages(["nginx", "curl"], present=False)
# Check if the operation was successful
if r.cp.return_code == 0:
    print("Packages removed 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.

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.