tmt.steps.prepare package
Subpackages
Submodules
tmt.steps.prepare.ansible module
- class tmt.steps.prepare.ansible.PrepareAnsible(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
PreparePlugin[PrepareAnsibleData]Prepare guest using Ansible.
Run Ansible playbooks against the guest, by running
ansible-playbookfor all given playbooks.Warning
When specifying playbooks with paths:
If a metadata tree root exists, all paths must be relative to the metadata tree root.
If the metadata tree root does not exist, all paths must be relative to the current working directory.
Warning
The plugin may be a subject of various limitations, imposed by Ansible itself:
Ansible 2.17+ no longer supports Python 3.6 and older. Guests where Python 3.7+ is not available cannot be prepared with the
ansibleplugin. This has been observed when Fedora Rawhide runner is used with CentOS 7 or CentOS Stream 8 guests. Possible workarounds: downgrade Ansible tmt uses, or install Python 3.7+ before usingansibleplugin from an alternative repository or local build.
Run a single playbook on the guest:
prepare: how: ansible playbook: ansible/packages.yml
prepare --how ansible --playbook ansible/packages.yml
Run multiple playbooks in one phase, with extra arguments for
ansible-playbook:prepare: how: ansible playbook: - one.yml - two.yml extra-args: '-vvv'
prepare --how ansible --playbook one.yml --playbook two.yml --extra-args '-vvv'
Remote playbooks can be referenced as well as local ones, and both kinds can be intermixed:
prepare: how: ansible playbook: - https://foo.bar/one.yml - two.yml
prepare --how ansible --playbook https://foo.bar/two.yml --playbook two.yml
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- essential_requires() list[DependencySimple | DependencyFmfId | DependencyFile]
Collect all essential requirements of the plugin.
Essential requirements of a plugin are necessary for the plugin to perform its basic functionality.
- Returns:
a list of requirements.
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) list[PhaseResult]
Prepare the guests
- class tmt.steps.prepare.ansible.PrepareAnsibleData(name: str, how: str, order: int = 50, summary: Optional[str] = None, where: list[str] = <factory>, playbook: list[str] = <factory>, extra_args: Optional[str] = None)
Bases:
PrepareStepData- extra_args: str | None = None
- playbook: list[str]
tmt.steps.prepare.distgit module
- class tmt.steps.prepare.distgit.DistGitData(name: str, how: str, order: int = 60, summary: Optional[str] = None, where: list[str] = <factory>, source_dir: Optional[tmt._compat.pathlib.Path] = None, phase_name: str = <factory>, install_builddeps: bool = False, require: list['tmt.base.DependencySimple'] = <factory>)
Bases:
PrepareStepData- install_builddeps: bool = False
- order: int = 60
- phase_name: str
- require: list[DependencySimple]
- source_dir: Path | None = None
- class tmt.steps.prepare.distgit.PrepareDistGit(*, discover: DiscoverPlugin[Any] | None = None, future_requires: PreparePlugin[Any] | None = None, future_recommends: PreparePlugin[Any] | None = None, **kwargs: Any)
Bases:
PreparePlugin[DistGitData]Companion to the discover-dist-git, place where
rpmbuild -bphappensStep is responsible: 1. Install required packages for the rpmbuild itself 2. Detect and install build requires 3. Patch sources (rpmbuild -bp) 4. Move patched sources from buildroot into TMT_SOURCE_DIR 5. Call function of discover plugin to discover tests from TMT_SOURCE_DIR
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) list[PhaseResult]
Prepare the guests for building rpm sources
- tmt.steps.prepare.distgit.insert_to_prepare_step(discover_plugin: DiscoverPlugin[Any], sourcedir: Path) None
Single place to call when inserting PrepareDistGit from discover
tmt.steps.prepare.install module
- class tmt.steps.prepare.install.Copr(*args: Any, guest: Guest, **kwargs: Any)
Bases:
CommonInitialize name and relation with the parent object
Prepare the workdir for provided id / directory path or generate a new workdir name if workdir=True given. Store command line context and options for future use if context is provided.
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str
- enable_copr(repositories: list[str]) None
Enable requested copr repositories
- enable_copr_epel6(copr: str) None
Manually enable copr repositories for epel6
- class tmt.steps.prepare.install.InstallApk(*, parent: PrepareInstall, guest: Guest, dependencies: list[DependencySimple], directories: list[Path], exclude: list[str], logger: Logger, **kwargs: Any)
Bases:
InstallBaseInstall packages using apk
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- install_debuginfo() None
Install debuginfo packages
- install_from_repository() None
Install packages from a repository
- install_from_url() None
Install packages stored on a remote URL
- install_local() None
Install packages stored in a local directory
- class tmt.steps.prepare.install.InstallApt(*, parent: PrepareInstall, guest: Guest, dependencies: list[DependencySimple], directories: list[Path], exclude: list[str], logger: Logger, **kwargs: Any)
Bases:
InstallBaseInstall packages using apt
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- install_debuginfo() None
Install debuginfo packages
- install_from_repository() None
Install packages from a repository
- install_from_url() None
Install packages stored on a remote URL
- install_local() None
Install packages stored in a local directory
- class tmt.steps.prepare.install.InstallBase(*, parent: PrepareInstall, guest: Guest, dependencies: list[DependencySimple], directories: list[Path], exclude: list[str], logger: Logger, **kwargs: Any)
Bases:
CommonBase class for installation implementations
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- install() None
Perform the actual installation
- install_debuginfo() None
Default base install method for debuginfo packages
- install_from_repository() None
Default base install method for packages from repositories
- install_from_url() None
Default base install method for packages which are from URL
- install_local() None
Default base install method for local packages
- list_installables(title: str, *installables: Package | FileSystemPath | PackagePath | PackageUrl) Iterator[Package | FileSystemPath | PackagePath | PackageUrl]
Show package info and return package names
- local_packages: list[PackagePath]
- package_directory: Path
- packages: list[Package | FileSystemPath]
- prepare_install_local() None
Copy packages to the test system
- prepare_installables(dependencies: list[DependencySimple], directories: list[Path]) None
Process package names and directories
- prepare_repository() None
Configure additional repository
- remote_packages: list[PackageUrl]
- rpm_check(package: str, mode: str = '-q') None
Run rpm command to check package existence Throws tmt.utils.RunError
- skip_missing: bool = False
- class tmt.steps.prepare.install.InstallDnf(*, parent: PrepareInstall, guest: Guest, dependencies: list[DependencySimple], directories: list[Path], exclude: list[str], logger: Logger, **kwargs: Any)
Bases:
InstallBase,CoprInstall packages using dnf
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str = 'dnf-plugins-core'
- install_debuginfo() None
Install debuginfo packages
- install_from_repository() None
Install packages from a repository
- install_from_url() None
Install packages stored on a remote URL
- install_local() None
Install packages stored in a local directory
- class tmt.steps.prepare.install.InstallDnf5(*, parent: PrepareInstall, guest: Guest, dependencies: list[DependencySimple], directories: list[Path], exclude: list[str], logger: Logger, **kwargs: Any)
Bases:
InstallDnfInstall packages using dnf5
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str = 'dnf5-command(copr)'
- class tmt.steps.prepare.install.InstallRpmOstree(*, parent: PrepareInstall, guest: Guest, dependencies: list[DependencySimple], directories: list[Path], exclude: list[str], logger: Logger, **kwargs: Any)
Bases:
InstallBase,CoprInstall packages using rpm-ostree
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str = 'dnf-plugins-core'
- enable_copr(repositories: list[str]) None
Enable requested copr repositories
- install_debuginfo() None
Install debuginfo packages
- install_from_repository() None
Install packages from the repository
- install_local() None
Install copied local packages
- recommended_packages: list[Package | FileSystemPath]
- required_packages: list[Package | FileSystemPath]
- sort_packages() None
Identify required and recommended packages
- class tmt.steps.prepare.install.InstallYum(*, parent: PrepareInstall, guest: Guest, dependencies: list[DependencySimple], directories: list[Path], exclude: list[str], logger: Logger, **kwargs: Any)
Bases:
InstallDnfInstall packages using yum
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str = 'yum-plugin-copr'
- class tmt.steps.prepare.install.PrepareInstall(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
PreparePlugin[PrepareInstallData]Install packages on the guest.
Example config:
prepare: how: install copr: psss/tmt package: tmt-all missing: fail
Use
coprfor enabling desired Copr repository andmissingto choose whether missing packages should be silently ignored (skip) or a preparation error should be reported (fail), which is the default.In addition to package name you can also use one or more paths to local rpm files to be installed:
prepare: how: install package: - tmp/RPMS/noarch/tmt-0.15-1.fc31.noarch.rpm - tmp/RPMS/noarch/python3-tmt-0.15-1.fc31.noarch.rpm
Use
directoryto install all packages from given folder andexcludeto skip selected packages:prepare: how: install directory: tmp/RPMS/noarch exclude: tmt+provision-virtual
Note
When testing ostree booted deployments tmt will use
rpm-ostreeas the package manager to perform the installation of requested packages. The current limitations of therpm-ostreeimplementation are:Cannot install new version of already installed local rpm.
No support for installing debuginfo packages at this time.
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) list[PhaseResult]
Perform preparation for the guests
- class tmt.steps.prepare.install.PrepareInstallData(name: str, how: str, order: int = 50, summary: Optional[str] = None, where: list[str] = <factory>, package: list[tmt.base.DependencySimple] = <factory>, directory: list[tmt._compat.pathlib.Path] = <factory>, copr: list[str] = <factory>, exclude: list[str] = <factory>, missing: Literal['skip', 'fail'] = 'fail')
Bases:
PrepareStepData- copr: list[str]
- directory: list[Path]
- exclude: list[str]
- missing: Literal['skip', 'fail'] = 'fail'
- package: list[DependencySimple]
tmt.steps.prepare.shell module
- class tmt.steps.prepare.shell.PrepareShell(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
PreparePlugin[PrepareShellData]Prepare guest using shell (Bash) scripts.
Run various commands and scripts on the guest:
prepare: how: shell script: - sudo dnf install -y 'dnf-command(copr)' - sudo dnf copr enable -y psss/tmt - sudo dnf install -y tmt
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) list[PhaseResult]
Prepare the guests
- class tmt.steps.prepare.shell.PrepareShellData(name: str, how: str, order: int = 50, summary: Optional[str] = None, where: list[str] = <factory>, script: list[tmt.utils.ShellScript] = <factory>)
Bases:
PrepareStepData- script: list[ShellScript]
- to_spec() dict[str, Any]
Convert to a form suitable for saving in a specification file
Module contents
- class tmt.steps.prepare.DependencyCollection(guests: list[~tmt.steps.provision.Guest], dependencies: list[~tmt.base.DependencySimple] = <factory>)
Bases:
objectBundle guests and packages to install on them
- property as_key: frozenset[DependencySimple]
- dependencies: list[DependencySimple]
- class tmt.steps.prepare.Prepare(*, plan: Plan, data: _RawStepData | list[_RawStepData], logger: Logger)
Bases:
StepPrepare the environment for testing.
Use the ‘order’ attribute to select in which order preparation should happen if there are multiple configs. Default order is ‘50’. Default order of required packages installation is ‘70’, for the recommended packages it is ‘75’.
Initialize prepare step data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- go(force: bool = False) None
Prepare the guests
- summary() None
Give a concise summary of the preparation
- wake() None
Wake up the step (process workdir and command line)
- class tmt.steps.prepare.PreparePlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
Plugin[PrepareStepDataT,list[PhaseResult]]Common parent of prepare plugins
Store plugin name, data and parent step
- classmethod base_command(usage: str, method_class: type[Command] | None = None) Command
Create base click command (common for all prepare plugins)
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) list[PhaseResult]
Prepare the guest (common actions)
- class tmt.steps.prepare.PrepareStepData(name: str, how: str, order: int = 50, summary: Optional[str] = None, where: list[str] = <factory>)
Bases:
WhereableStepData,StepData