teemtee / tmt

Test Management Tool
MIT License
77 stars 117 forks source link

Exception when running Ansible preparation from CLI #3051

Open mizdebsk opened 1 week ago

mizdebsk commented 1 week ago

When trying to run prepare --how ansible from command line, tmt crashes with an exception.

I'm using latest tmt from main branch (commit 9717fc412d27256a10e7eef5319cc279ec3c4e2c).

Reproducer:

  1. Initialize new tmt tree with tmt init

  2. Write Ansible playbook as hello.yml with the following contents:

- hosts: all
  gather_facts: no
  tasks:
    - debug:
        msg: hello
  1. Run the following command:
tmt run provision --how container --image fedora:rawhide prepare --how ansible --playbook hello.yml

Expected results:

Preparations are applied without error.

Actual results:

/var/tmp/tmt/run-001

/default/plan

plan failed

The exception was caused by 1 earlier exceptions

Cause number 1:

    Failed to load step data for PrepareAnsibleData: 

    The exception was caused by 1 earlier exceptions

    Cause number 1:
happz commented 1 week ago

@mizdebsk I didn't notice you also provided a fix, thanks for that. But... I don't want to sound ungrateful, yet I'd prefer my patch, there's also a bug in handling of playbooks key (which is still supported in fmf files), and includes an improvement to a library function that's exactly the right for the job.

mizdebsk commented 1 week ago

Thanks for your better fix @happz. I wrote my patch to make tmt work for me because I didn't expect any fix that quickly, but I'll happily switch to yours.