-
Notifications
You must be signed in to change notification settings - Fork 656
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
Inconsistent/incorrect behaviour between playbooks and roles #488
Comments
Is anyone looking at this? It seems pretty important. |
Per the docs For the skipping piece… I successfully skipped the given example role task with |
Hi, I understand that the doc says that. My point is that the output is very badly misleading and the opportunity for users to believe that the code has been linted and passed should be obvious. If the application is passed something it can't work with, it should say so. I spent several more hours testing. I believe I have found the issue. I created a new role to test. Using The complete role is attached for your testing. |
That is a good point, I will make a separate issue to discuss exiting with error code if we cannot lint a .yml (i.e. it's not a playbook) Thank you for the detailed testing! You should be able to drag and drop a file to attach it, I will take a look. |
Super, thanks. |
Closing as very old and most of the code changed since. If you still find it misbehaving please build a minimal reproducing case. Keep in mind that at this moment the linter allows you to pass only playbooks and roles, not other file types. |
Please re-open this. All you have to do is test against the test role provided to see that there are 300-series warnings which arent suppressed. |
Issue Type
Ansible and Ansible Lint details
Desired Behaviour
Playbooks and roles should be linted consistently. Rule exclusion should work consistently.
Actual Behaviour (Bug report only)
Structure:
playbook.yml
roles
-myrole
--tasks
---main.yaml
---[other task files]
playbook.yml includes myrole.
ansible-lint -c ./tests/ansibleLint/.ansible-lint ./playbook.yml -v
If I run ansible-lint against the playbook, the role is included, all files are parsed as shown in the output and lint errors displayed.
ansible-lint -c ./tests/ansibleLint/.ansible-lint ./roles/myrole -v
If I run ansible-lint against the role, all role files are parsed as shown in the output and lint errors displayed.
ansible-lint -c ./tests/ansibleLint/.ansible-lint ./roles/myrole/tasks -v
If I run ansible-lint against the role's
tasks
directory, no task files are parsed as shown in the output and no errors displayed.ansible-lint -c ./tests/ansibleLint/.ansible-lint ./roles/myrole/tasks/main.yml -v
If I run ansible-lint against the role's
tasks/main.yml
, all task files are parsed as shown in the output and no lint errors displayed.ansible-lint -c ./tests/ansibleLint/.ansible-lint ./roles/myrole/tasks/otherfile.yml -v
If I run ansible-lint against any other file in the the role's
tasks
directory`, the file is parsed as shown in the output and no lint errors displayed.That just seems wrong and nothing is output to expain it. If you don't have verbose output on you wouldn't even know, you'd just think all files has passed the tests.
Further, using E301 as an example. I have the following example task:
which raises
[E301] Commands should not change things if nothing needs doing
along with others that raise the same error.
I am unable to selectively disable this warning in the role.
warn=no
does not work.noqa
does not work anywhere in the task.does not work.
does work and is the only option that does.
All of these options work as expected when used in a playbook.
I have a
.ansible-lint
file which is similar to:The text was updated successfully, but these errors were encountered: