Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Use ansible to gather failure details #377

@mike-nguyen

Description

@mike-nguyen

AHT currently uses a custom callback plugin to get the task and details of a failure in Ansible. Ansible's block/rescue creates a variable called ansible_failed_task and ansible_failed_result that stores the details of a failure allowing access to a failure without a custom callback plugin.

Caveats

  • Blocks do not work with roles so roles must be called using include_role/import_role. There is a maximum recursion depth for include_role so we have to use the static import_role when possible.

  • There is currently a bug in Ansible where the ansible_failed_task and ansible_failed_result is not available when running in a loop. This can be worked around but makes the code not as clean.

Advantages

  • Eliminate reliance on custom callback plugin. There is less code to maintain since block/rescue is all Ansible. It also allows AHT to use any plugin (maybe xunit for the standard test interface?)
  • More flexibility to perform actions based on failures

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions