atomic-host-tests icon indicating copy to clipboard operation
atomic-host-tests copied to clipboard

Use ansible to gather failure details

Open mike-nguyen opened this issue 7 years ago • 2 comments

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

mike-nguyen avatar Apr 16 '18 14:04 mike-nguyen

There is currently a bug in Ansible where the ansible_failed_task and ansible_failed_result is not available when running in a loop.

Is there a link to the issue/bug?

Overall, this seems like a good proposal and I'm in favor of pursuing it. My outstanding question is how this would interact with Fedora STI, if at all.

miabbott avatar Apr 17 '18 17:04 miabbott

There are a few open issues for ansible_failed_task/ansible_failed_result but none of them are resolved yet. Here is one of them: https://github.com/ansible/ansible/issues/29047

mike-nguyen avatar Apr 17 '18 17:04 mike-nguyen