-
Notifications
You must be signed in to change notification settings - Fork 635
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
Schema[playbook] report a warning about invalid schema if 'var_files' is used #2474
Schema[playbook] report a warning about invalid schema if 'var_files' is used #2474
Comments
Current schema implementation for Even the official ansible meta-datadump reports the keyword as:
This makes me believe that this is not a bug. The fact that Ansible might let you feed it something else might count as an accidental/undocumented behavior. I will double check before closing as wontfix as changing it to allow simple tring is easy, but easy is not necessarily good in longer term. |
all 'list' types in ansible allow single string as they get 'auto magically' converted into list of single element |
I failed to find both the documentation and the meta-data about vars_files parameters. I wasn't aware it is waiting for a list. Sorry about that. I'm not sure what ansible-lint should do, either accept a string or not, but a more verbose output would make a long way in making our lives easier. My playbook is invalid, ok, but why? Using -vvv doesn't help. |
Yep, this bug is open to remind me that I need to update our schemas to always allow a string for fields that allow lists. It is not only |
@ssbarnea sound reasoning. Thanks for your work. And thanks for the solution (convert string to list). I leave this issue open as a reminder then. |
it is documented, the problem is you are equating 'Ansible types' to JSON ones and they are not the same. When you have 'type: list' also can also have an 'elements:' keyword that describe the allowed elements for the list (if omitted 'any/raw' is assumed). None/null is allowed for all types. |
@bcoca Here is a related on https://github.com/ansible/schemas/issues/401 -- and for this I was not able to find any documentation or examples stating that for vars you can feed it a list of dictionaries. |
no list of lists (of paths), vars/vars_prompt are list of dictionaries, also vars_files when it is a list of lists uses a 'first found' logic The original example |
Summary
When a playbook uses the option 'var_files', ansible-lint report a warning about invalid schema
Issue Type
Ansible and Ansible Lint details
OS / ENVIRONMENT
Fedora
STEPS TO REPRODUCE
run `ansible-lint -v playbooks/test.yml
Desired Behavior
I expect the playbook to be valid.
Actual Behavior
ansible-playbook --syntax-check playbook
ansible-playbook --syntax-check passes
The text was updated successfully, but these errors were encountered: