You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a task file that is part of a role which is used by a top-level playbook.
Ansible-lint reports a warning when checking the following file whereas I believe it is mistaken because the task works as expected. I suspect the environment key to cause the warning.
This has been already reported on #2888, but is popping up again somehow.
Create the following test.yml file inside a tasks folder of a local role, e.g. roles/myrole/tasks/main.yml:
---
- name: Run npm run prodansible.builtin.command: npm run prodenvironment:
DISABLE_V8_COMPILE_CACHE: 1changed_when: false
Run ansible-lint:
ansible-lint roles/myrole/tasks/main.yml
Desired Behavior
No warning is issued.
Actual Behavior
A warning is issued.
WARNING Listing 1 violation(s) that are fatal
schema[tasks]: {'name': 'Check some command', 'ansible.builtin.command': {'cmd': 'someCommand'}, 'environment': {'my_env_var': 1}, 'register': 'command_result', 'failed_when': 'command_result.rc > 2', 'changed_when': "command_result.stdout != ''"} is not valid under any of the given schemas
The text was updated successfully, but these errors were encountered:
The warning is valid but the error that comes from the python JSON schema validator is of poor quality, not being specific enough.
You can fix the issue very easy by adding quotes around "1".
The funny part is that using the same schema, YAML-language-server is able to give a very good error message, only the python-json-schema validator gives the poor one, and that is the one used by ansible-lint.
We need to keep this bug open till we find a way to improve the error messages, at least for something as simple as this one.
Summary
I have a task file that is part of a role which is used by a top-level playbook.
Ansible-lint reports a warning when checking the following file whereas I believe it is mistaken because the task works as expected. I suspect the environment key to cause the warning.
This has been already reported on #2888, but is popping up again somehow.
Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
Create the following test.yml file inside a tasks folder of a local role, e.g.
roles/myrole/tasks/main.yml
:Run ansible-lint:
ansible-lint roles/myrole/tasks/main.yml
Desired Behavior
No warning is issued.
Actual Behavior
A warning is issued.
The text was updated successfully, but these errors were encountered: