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

crash with exception on simple file #1082

Closed
jokjr opened this issue Oct 26, 2020 · 2 comments · Fixed by #1157
Closed

crash with exception on simple file #1082

jokjr opened this issue Oct 26, 2020 · 2 comments · Fixed by #1157
Assignees
Labels

Comments

@jokjr
Copy link

jokjr commented Oct 26, 2020

Summary

While this file is probably not valid YAML, ansible-lint crashes with a not terribly useful error message - hello.yml:

abc
Issue Type
  • Bug Report
Ansible and Ansible Lint details
ansible --version
ansible 2.9.13
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.7/site-packages/ansible
  executable location = /home/user/.local/bin/ansible
  python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]

ansible-lint --version
ansible-lint 4.3.4
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Debian. (older) versions of ansible and ansible-lint are installed through the package manager as well.

STEPS TO REPRODUCE

Test case hello.yml:

abc
ansible-lint hello.yml
Desired Behaviour

A single error line saying that it couldn't find any items in the alleged playbook?

Actual Behaviour
$ cat hello.yml
abc
$ ansible-lint -vvvvvvv hello.yml
Traceback (most recent call last):
  File "/home/user/.local/bin/ansible-lint", line 10, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.7/site-packages/ansiblelint/__main__.py", line 160, in main
    matches.extend(runner.run())
  File "/home/user/.local/lib/python3.7/site-packages/ansiblelint/runner.py", line 78, in run
    matches = set(self._emit_matches(files))
  File "/home/user/.local/lib/python3.7/site-packages/ansiblelint/runner.py", line 103, in _emit_matches
    for child in ansiblelint.utils.find_children(arg, self.playbook_dir):
  File "/home/user/.local/lib/python3.7/site-packages/ansiblelint/utils.py", line 162, in find_children
    items = _playbook_items(playbook_ds)
  File "/home/user/.local/lib/python3.7/site-packages/ansiblelint/utils.py", line 137, in _playbook_items
    return [item for play in pb_data for item in play.items()]
  File "/home/user/.local/lib/python3.7/site-packages/ansiblelint/utils.py", line 137, in <listcomp>
    return [item for play in pb_data for item in play.items()]
AttributeError: 'str' object has no attribute 'items'

@jokjr jokjr added priority/medium new Triage required labels Oct 26, 2020
@ssbarnea
Copy link
Member

This is likely already fixed by #1048 which is blocked by #815 -- hopefully the situation will be addressed soon.

@gundalow ^

@tcinbis
Copy link

tcinbis commented Nov 17, 2020

@ssbarnea thanks for the insight! I am facing the same issue since recently :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants