tmt.steps.prepare package
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
Single playbook config:
prepare: how: ansible playbook: ansible/packages.yml
Multiple playbooks config:
prepare: how: ansible playbook: - playbook/one.yml - playbook/two.yml - playbook/three.yml extra-args: '-vvv'
Remote playbooks can be referenced as well as local ones, and both kinds can be intermixed:
prepare: how: ansible playbook: - playbook/one.yml - https://foo.bar/two.yml - playbook/three.yml
The playbook path should be relative to the metadata tree root. Use ‘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’.
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- 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.install module
- class tmt.steps.prepare.install.InstallBase(*, parent: PrepareInstall, guest: Guest, logger: Logger)
Bases:
CommonBase class for installation implementations
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str
- debuginfo_packages: list[str]
- directories: list[tmt.utils.Path]
- enable_copr() None
Enable requested copr repositories
- enable_copr_epel6(copr: str) None
Manually enable copr repositories for epel6
- exclude: list[str]
- 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
- local_packages: list[tmt.utils.Path]
- operation_script(subcommand: Command, args: Command) ShellScript
Render a shell script to perform the requested package operation.
Warning
Each and every argument from
argswill be sanitized by escaping. This is not compatible with operations that wish to use shell wildcards. Such operations need to be constructed manually.- Parameters:
subcommand – package manager subcommand, e.g.
installorerase.args – arguments for the subcommand, e.g. package names.
- package_manager: str
- packages: list[str]
- perform_operation(subcommand: Command, args: Command) CommandOutput
Perform the requested package operation.
Warning
Each and every argument from
argswill be sanitized by escaping. This is not compatible with operations that wish to use shell wildcards. Such operations need to be constructed manually.- Parameters:
subcommand – package manager subcommand, e.g.
installorerase.args – arguments for the subcommand, e.g. package names.
- Returns:
command output.
- prepare_command() tuple[tmt.utils.Command, tmt.utils.Command]
Prepare installation command and subcommand options
- prepare_install_local() None
Copy packages to the test system
- prepare_packages() None
Process package names and directories
- prepare_repository() None
Configure additional repository
- remote_packages: list[str]
- repository_packages: list[str]
- skip_missing: bool = False
- class tmt.steps.prepare.install.InstallDnf(*, parent: PrepareInstall, guest: Guest, logger: Logger)
Bases:
InstallBaseInstall 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 the repository
- install_from_url() None
Install packages directly from URL
- install_local() None
Install copied local packages
- package_manager: str = 'dnf'
- prepare_command() tuple[tmt.utils.Command, tmt.utils.Command]
Prepare installation command
- skip_missing_option = '--skip-broken'
- class tmt.steps.prepare.install.InstallDnf5(*, parent: PrepareInstall, guest: Guest, logger: Logger)
Bases:
InstallDnfInstall packages using dnf5
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str = 'dnf5-plugins'
- package_manager: str = 'dnf5'
- skip_missing_option = '--skip-unavailable'
- class tmt.steps.prepare.install.InstallRpmOstree(*, parent: PrepareInstall, guest: Guest, logger: Logger)
Bases:
InstallBaseInstall packages using rpm-ostree
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 the repository
- install_local() None
Install copied local packages
- package_manager: str = 'rpm-ostree'
- prepare_command() tuple[tmt.utils.Command, tmt.utils.Command]
Prepare installation command for rpm-ostree
- sort_packages() None
Identify required and recommended packages
- class tmt.steps.prepare.install.InstallYum(*, parent: PrepareInstall, guest: Guest, logger: Logger)
Bases:
InstallDnfInstall packages using yum
Initialize installation data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- copr_plugin: str = 'yum-plugin-copr'
- install_from_repository() None
Install packages from the repository
- package_manager: str = 'yum'
- 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 ‘copr’ for enabling desired copr repository and ‘missing’ to choose if 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 ‘directory’ to install all packages from given folder and ‘exclude’ to skip selected packages:
prepare: how: install directory: tmp/RPMS/noarch exclude: tmt+provision-virtual
Use ‘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’.
Note: When testing ostree booted deployments tmt will use rpm-ostree as the package manager to perform the installation of requested packages. The current limitations of the rpm-ostree implementation 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
- 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.utils.Path] = <factory>, copr: list[str] = <factory>, exclude: list[str] = <factory>, missing: Literal['skip', 'fail'] = 'fail')
Bases:
PrepareStepData- copr: list[str]
- directory: list[tmt.utils.Path]
- exclude: list[str]
- missing: Literal['skip', 'fail'] = 'fail'
- package: list[tmt.base.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
Example config:
- prepare:
how: shell script: - sudo dnf install -y ‘dnf-command(copr)’ - sudo dnf copr enable -y psss/tmt - sudo dnf install -y tmt
Use ‘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’.
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- 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[tmt.utils.ShellScript]
- to_spec() dict[str, Any]
Convert to a form suitable for saving in a specification file
Module contents
- class tmt.steps.prepare.Prepare(*, plan: Plan, data: _RawStepData | list[tmt.steps._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]Common parent of prepare plugins
Store plugin name, data and parent step
- classmethod base_command(usage: str, method_class: type[click.core.Command] | None = None) Command
Create base click command (common for all prepare plugins)
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- class tmt.steps.prepare.PrepareStepData(name: str, how: str, order: int = 50, summary: Optional[str] = None, where: list[str] = <factory>)
Bases:
WhereableStepData,StepData