Skip to content

Add validation to prevent unexpected types in environment variables #1030

@AlanCoding

Description

@AlanCoding

Demo in python console:

>>> import ansible_runner.interface
>>> ansible_runner.interface.run(private_data_dir='demo', playbook='test.yml')
[WARNING]: You are running the development version of Ansible. You should only
run Ansible from "devel" if you are modifying the Ansible engine, or trying out
features under development. This is a rapidly changing source of code and can
become unstable at any point.

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "msg": "Test!"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
<ansible_runner.runner.Runner object at 0x7f83863bfbe0>
>>> ansible_runner.interface.run(private_data_dir='demo', playbook='test.yml', envvars={'ALAN': True})

There it hangs. This is experiencing the traceback pasted in ansible/awx#11993, but doing so silently.

The fix is to use envvars={'ALAN': 'True'} instead.

However, the poor error handling incurs significant cost in terms of people tracking down the root cause. Runner should avoid this by giving a descriptive error right away.

It would also be ideal to figure out why tracebacks are not getting surfaced, which may be a pexpect upstream issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions