Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation to prevent unexpected types in environment variables #1030

Open
AlanCoding opened this issue Apr 1, 2022 · 2 comments
Open
Labels
bug Something isn't working

Comments

@AlanCoding
Copy link
Member

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.

@github-actions github-actions bot added the needs_triage New item that needs to be triaged label Apr 1, 2022
@Shrews Shrews added bug Something isn't working and removed needs_triage New item that needs to be triaged labels Apr 5, 2022
@Shrews
Copy link
Contributor

Shrews commented Apr 5, 2022

Agreed. Definitely something we should investigate.

@AlanCoding
Copy link
Member Author

We already have an upstream issue, and here it is: pexpect/pexpect#512

There is a proposed fix at pexpect/ptyprocess#47, which was not even in dispute, ending at

Whichever one of us finds time to get to this first

Predictably, it has been stuck there for over 2 years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants