dnf module¶
DnfAvailableGroups
¶
The available (not-yet-installed) dnf groups, as DnfGroup dicts.
Commands:
dnf group list --available
Returns:
list[DnfGroup]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_available_groups.py.
DnfDisabledModules
¶
The disabled dnf modules, as a sorted list of DnfModule dicts.
Commands:
dnf module list --disabled
Returns:
list[DnfModule]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_disabled_modules.py.
DnfEnabledModules
¶
The enabled dnf modules, as a sorted list of DnfModule dicts.
Commands:
dnf module list --enabled
Returns:
list[DnfModule]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_enabled_modules.py.
DnfGroup
¶
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The package-group name, exactly as |
DnfGroups
¶
The installed dnf groups, as a sorted list of DnfGroup dicts.
Commands:
dnf group list --installed
Returns:
list[DnfGroup]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_groups.py.
DnfInstalledModules
¶
The installed dnf modules, as a sorted list of DnfModule dicts.
Commands:
dnf module list --installed
Returns:
list[DnfModule]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_installed_modules.py.
DnfModule
¶
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The dnf module name (an application-stream family). |
|
stream |
The module stream the row's flag applies to. For
|
DnfPackageInfo
¶
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The package name, exactly as |
|
versions |
The package's installed versions (rpm's
|
DnfPackages
¶
The installed dnf packages, as a sorted list of DnfPackageInfo dicts.
Commands:
rpm -qa --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n'
Returns:
list[DnfPackageInfo]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_packages.py.
DnfRepoFile
¶
The current content of one .repo file, or None when it is absent.
Commands:
test -e <path> && { printf '#reemote-repofile\n'; cat -- <path>; }
Returns:
str | None
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_repo.py.
DnfRepoList
¶
The runtime dnf repositories, as a list of DnfRepoListEntry dicts.
Commands:
dnf repolist --all
Returns:
list[DnfRepoListEntry]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_repo_list.py.
DnfRepoListEntry
¶
Attributes:
| Name | Type | Description |
|---|---|---|
repoid |
The repository id (the row's first column). |
|
name |
The human-readable repository name (possibly multi-word). |
|
status |
|
DnfRepositories
¶
The configured dnf repositories, as a list of DnfRepository dicts.
Commands:
for f in /etc/dnf.conf /etc/dnf.repos.d/*.repo /etc/yum.repos.d/*.repo; do [ -f "$f" ] && { printf "#reemote-filename: %s\n" "$f"; cat "$f"; }; done || true
Returns:
list[DnfRepository]
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_repositories.py.
DnfRepository
¶
Attributes:
| Name | Type | Description |
|---|---|---|
repoid |
The repository id (the |
|
name |
The human-readable repository name (the |
|
filename |
The config/ |
|
options |
The section's remaining |
RpmGpgKey
¶
Attributes:
| Name | Type | Description |
|---|---|---|
keyid |
The key's short id -- the last 8 hex digits of its GPG key
id, lowercased exactly as rpm stores it in the pseudo-package's
|
|
release |
The pseudo-package's |
|
summary |
The pseudo-package's |
RpmGpgKeys
¶
The GPG keys imported into the rpm keyring, as RpmGpgKey dicts.
Commands:
rpm -qa gpg-pubkey --queryformat '%{VERSION} %{RELEASE} %{SUMMARY}\n'
Returns:
list[RpmGpgKey]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/rpm_gpg_keys.py.
RpmPackage
¶
The name and version of a .rpm file or an installed package.
Commands:
rpm --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' -q <package> || ! test -e <package> || rpm --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' -qp <package> 2> /dev/null
Returns:
RpmPackageInfo | None
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_rpm.py.
RpmPackageInfo
¶
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The package name rpm reports for the queried name/file. |
|
version |
The package's version -- rpm's |
clean
async
¶
clean(
ctx: OpContext,
what: str = "all",
repos: str | list[str] | tuple[str, ...] | None = None,
**kwargs: Any,
) -> AsyncGenerator[Command]
Remove dnf cached data, optionally scoped to repos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
what
|
str
|
The cache kind to remove: |
'all'
|
repos
|
str | list[str] | tuple[str, ...] | None
|
Repository
ids to scope the removal to ( |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
The clean command, always (the operation is stateless). |
Raises:
CommandNotFoundError, HostConnectionError, ValueError
Examples:
Examples can be found in examples/modules/dnf/dnf_clean.py.
key
async
¶
key(
ctx: OpContext,
src: IO[Any] | None = None,
keyid: str | None = None,
present: bool = True,
**kwargs: Any,
) -> AsyncGenerator[Command]
Import a GPG key into, or remove one from, the target's rpm keyring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
src
|
IO[Any] | None
|
The key content as a seekable IO-like
object on the control machine (an |
None
|
keyid
|
str | None
|
The key to remove when |
None
|
present
|
bool
|
|
True
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
The key transfer and import commands, always, when
|
Raises:
CommandNotFoundError, HostConnectionError, ValueError
Examples:
Examples can be found in examples/modules/dnf/dnf_key.py.
makecache
async
¶
makecache(
ctx: OpContext,
repos: str | list[str] | tuple[str, ...] | None = None,
**kwargs: Any,
) -> AsyncGenerator[Command]
Download/refresh dnf repository metadata, optionally scoped to repos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
repos
|
str | list[str] | tuple[str, ...] | None
|
Repository
ids to scope the refresh to ( |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
The makecache command, always (the operation is stateless). |
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_makecache.py.
module
async
¶
module(
ctx: OpContext,
module: str,
stream: str | None = None,
enabled: bool = True,
**kwargs: Any,
) -> AsyncGenerator[Command]
Enable/disable a dnf module stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
module
|
str
|
Name of the dnf module (an application-stream family). |
required |
stream
|
str | None
|
The stream to enable; required when
|
None
|
enabled
|
bool
|
|
True
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated dnf module commands. |
Raises:
CommandNotFoundError, HostConnectionError, ValueError
Examples:
Examples can be found in examples/modules/dnf/dnf_module.py.
packages
async
¶
packages(
ctx: OpContext,
packages: str
| list[str]
| tuple[str, ...]
| None = None,
present: bool = True,
latest: bool = False,
update: bool = False,
clean: bool = False,
nobest: bool = False,
extra_install_args: str | None = None,
extra_uninstall_args: str | None = None,
**kwargs: Any,
) -> AsyncGenerator[Command]
Install/remove/update dnf packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
packages
|
str | list[str] | tuple[str, ...] | None
|
Packages
to ensure. Prefer tuples when building requests via |
None
|
present
|
bool
|
Whether the packages should be installed. Defaults to True. |
True
|
latest
|
bool
|
Whether to upgrade installed packages without a pinned version. Defaults to False. |
False
|
update
|
bool
|
Run |
False
|
clean
|
bool
|
Run |
False
|
nobest
|
bool
|
Add the |
False
|
extra_install_args
|
str | None
|
Additional arguments to the dnf install command. Defaults to None. |
None
|
extra_uninstall_args
|
str | None
|
Additional arguments to the dnf remove command. Defaults to None. |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated dnf package commands. |
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/dnf/dnf_packages.py.
repo
async
¶
repo(
ctx: OpContext,
src: str,
present: bool = True,
baseurl: str | None = None,
description: str | None = None,
enabled: bool = True,
gpgcheck: bool = True,
gpgkey: str | None = None,
includepkgs: str | None = None,
repo_gpgcheck: bool | None = None,
proxy: str | None = None,
proxy_username: str | None = None,
proxy_password: str | None = None,
**kwargs: Any,
) -> AsyncGenerator[Command]
Add/remove/update a dnf repository .repo file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
src
|
str
|
The repository name; the file is
|
required |
present
|
bool
|
Whether the |
True
|
baseurl
|
str | None
|
The repository's |
None
|
description
|
str | None
|
The |
None
|
enabled
|
bool
|
Whether the repo is |
True
|
gpgcheck
|
bool
|
Whether to set |
True
|
gpgkey
|
str | None
|
The |
None
|
includepkgs
|
str | None
|
The |
None
|
repo_gpgcheck
|
bool | None
|
The |
None
|
proxy
|
str | None
|
The |
None
|
proxy_username
|
str | None
|
The |
None
|
proxy_password
|
str | None
|
The |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated dnf repository file commands. |
Raises:
CommandNotFoundError, HostConnectionError, ValueError
Examples:
Examples can be found in examples/modules/dnf/dnf_repo.py.
rpm
async
¶
Add/remove a .rpm file package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
src
|
str
|
Path to the |
required |
present
|
bool
|
Whether the package should be installed. Defaults to True. |
True
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated dnf rpm package commands. |
Raises:
CommandNotFoundError, HostConnectionError, ValueError
Examples:
Examples can be found in examples/modules/dnf/dnf_rpm.py.
update
async
¶
Update every dnf package on the host.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
The dnf update command, always (the operation is stateless). |
Raises:
None
Examples:
Examples can be found in examples/modules/dnf/dnf_update.py.