tmt.steps.finish package

Submodules

tmt.steps.finish.ansible module

class tmt.steps.finish.ansible.FinishAnsible(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)

Bases: FinishPlugin[FinishStepData], PrepareAnsible

Perform finishing tasks using ansible.

One or more playbooks can be provided as a list under the playbook attribute. Each of them will be applied using ansible-playbook in the given order. The path must be relative to the metadata tree root.

Remote playbooks can be referenced as well as the local ones, and both kinds can be used at the same time.

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 ansible plugin. 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 using ansible plugin from an alternative repository or local build.

Single playbook config:

finish:
    how: ansible
    playbook: ansible/packages.yml

Multiple playbooks config:

finish:
    how: ansible
    playbook:
      - playbooks/common.yml
      - playbooks/os/rhel9.yml
      - https://foo.bar/rhel9-final-touches.yml

The playbook path should be relative to the metadata tree root. Use the order attribute to select in which order finishing tasks should happen if there are multiple configs. Default order is 50.

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 finish plugins)

cli_invocation: 'tmt.cli.CliInvocation' | None = None
go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome

Prepare the guests

tmt.steps.finish.shell module

class tmt.steps.finish.shell.FinishShell(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)

Bases: FinishPlugin[FinishStepData], PrepareShell

Perform finishing tasks using shell (bash) scripts.

Execute arbitrary shell commands to finish the testing. Default shell options are applied to the script, see the test key specification for more details.

Example config:

finish:
    how: shell
    script:
      - upload-logs.sh || true
      - rm -rf /tmp/temporary-files

Scripts can also be fetched from a remote git repository. Specify the url for the repository and optionally ref to checkout a specific branch, tag or commit. TMT_FINISH_SHELL_URL_REPOSITORY will hold the value of the repository path.

finish:
    how: shell
    url: https://github.com/teemtee/tmt.git
    ref: main
    script: cd $TMT_FINISH_SHELL_URL_REPOSITORY && make docs

Use the order attribute to select in which order finishing tasks should happen if there are multiple configs. Default order is 50.

Store plugin name, data and parent step

cli_invocation: 'tmt.cli.CliInvocation' | None = None
go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome

Prepare the guests

Module contents

class tmt.steps.finish.Finish(*, plan: Plan, data: _RawStepData | list[_RawStepData] | None = None, name: str | None = None, workdir: Literal[True] | Path | None = None, logger: Logger)

Bases: Step

Perform the finishing tasks

Additional actions to be performed after the test execution has been completed. Counterpart of the prepare step useful for various cleanup or log-gathering actions.

Initialize and check the step data

cli_invocation: 'tmt.cli.CliInvocation' | None = None
cli_invocations: list['tmt.cli.CliInvocation'] = []
go(force: bool = False) None

Execute finishing tasks

summary() None

Give a concise summary

wake() None

Wake up the step (process workdir and command line)

class tmt.steps.finish.FinishPlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)

Bases: Plugin[FinishStepDataT, PluginOutcome]

Common parent of finish 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 finish plugins)

cli_invocation: 'tmt.cli.CliInvocation' | None = None
go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome

Perform actions shared among plugins when beginning their tasks

class tmt.steps.finish.FinishStepData(name: str, how: str, order: int = 50, when: list[str] = <factory>, summary: str | None = None, where: list[str] = <factory>)

Bases: WhereableStepData, StepData