-
Notifications
You must be signed in to change notification settings - Fork 640
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
Empty task "-" crashes ansible-lint #468
Comments
We can make a change to prevent ansible-lint from crashing on an empty task ( I’m not sure how useful it would be, but we could have a line-based rule to check for a line equal to |
That sounds good. |
facing this error and the verbosity is useless. At least pinpoint which file has the error and if possible which task line |
This is very desirable function. I'm trying to check my playbook using ansible-lint now, but I'm hit with this error on first run. Any tips on quickly locating the offending role / tasks? |
As ansible allows tasks to be None, we should also avoid crashing when encountering them. Includes regression prevention by assuring we can parse files with empty tasks. Fixes: #468
As ansible allows tasks to be None, we should also avoid crashing when encountering them. Includes regression prevention by assuring we can parse files with empty tasks. Fixes: #468
As ansible allows tasks to be None, we should also avoid crashing when encountering them. Includes regression prevention by assuring we can parse files with empty tasks. Fixes: #468
As ansible allows tasks to be None, we should also avoid crashing when encountering them. Includes regression prevention by assuring we can parse files with empty tasks. Fixes: #468
As ansible allows tasks to be None, we should also avoid crashing when encountering them. Includes regression prevention by assuring we can parse files with empty tasks. Fixes: #468
Version bump to fix crashes on empty tasks [1] * ansible-lint has been bumped to 4.3.0 * Move most of tasks from skip_list to warn_list allowing to see them on every task. * 106,201,206,207,208,305,601 exceptions are added to warn_list. All of these exceptions were not present in ansible-lint < 4.3.0. All of them can be seen in the jobs. [1] ansible/ansible-lint#468 Change-Id: I1ea6c2c6776dc5c07925f13bfa968dfeca74f5ca
Issue Type
Ansible and Ansible Lint details
pip install --user ansible
pre-commit call with git commit -a --amend
Desired Behaviour
If you have a list of tasks with an empty want if have to report you as failure
debug:
msg: Hello world
Actual Behaviour (Bug report only)
Instead of failing with a proper message it crashes
Traceback (most recent call last):
File "/home/ellorent/.cache/pre-commit/repoHkh3h8/py_env-python2/bin/ansible-lint", line 11, in
sys.exit(main())
File "/home/ellorent/.cache/pre-commit/repoHkh3h8/py_env-python2/lib/python2.7/site-packages/ansiblelint/main.py", line 176, in main
matches.extend(runner.run())
File "/home/ellorent/.cache/pre-commit/repoHkh3h8/py_env-python2/lib/python2.7/site-packages/ansiblelint/init.py", line 229, in run
for child in ansiblelint.utils.find_children(arg, self.playbook_dir):
File "/home/ellorent/.cache/pre-commit/repoHkh3h8/py_env-python2/lib/python2.7/site-packages/ansiblelint/utils.py", line 169, in find_children
items = _playbook_items(playbook_ds)
File "/home/ellorent/.cache/pre-commit/repoHkh3h8/py_env-python2/lib/python2.7/site-packages/ansiblelint/utils.py", line 154, in _playbook_items
return [item for play in pb_data for item in play.items()]
AttributeError: 'NoneType' object has no attribute 'items'
The text was updated successfully, but these errors were encountered: