Skip to content

testaid reporting undefined var but it is not used in my test #9

Description

@urwotu8

with test_default.py like :-

import os
from six.moves import urllib

import testinfra.utils.ansible_runner
import testaid
import json

testinfra_hosts = testaid.hosts()

def test_version_is_correct(host, testvars):
    verfile = host.file('/media/atl/product/shared/'+testvars['product_edition']+'.version')
    assert verfile.exists
    assert verfile.content.decode("UTF-8").strip() == "22.13.1"

getting:-

        if rc.failed_playbook_run:
            raise AnsibleRunError(
                'Unable to run playbook.',
>               rc.result_playbook_run[-1])
E           testaid.exceptions.AnsibleRunError: Unable to run playbook.
E           Error message: The task includes an option with an undefined variable. The error was: 'product_family' is undefined

../../.venv/lib/python3.7/site-packages/testaid/ansiblerun.py:36: AnsibleRunError

put in a pprint for the playbook object passed to moleculeplay.run_playbook :-

playbook passed in:-
{'gather_facts': 'True',
 'hosts': 'amazon_linux2',
 'name': 'ansible playbook',
 'roles': [{'name': 'linux_common', 'when': 'False'},
           {'name': 'product_common', 'when': 'False'},
           {'name': 'product_install', 'when': 'False'}],
 'tasks': [{'action': {'args': {'msg': '{{ vars }}'}, 'module': 'debug'}}],
 'vars_files': []}

should i expect playbook.name to contain something more meaningful (like reference to the actual playbook file?)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions