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

AttributeError: 'AnsibleUnicode' object has no attribute 'open' (SARIF file) #3570

Closed
vooon opened this issue Jun 16, 2023 · 0 comments · Fixed by #3587
Closed

AttributeError: 'AnsibleUnicode' object has no attribute 'open' (SARIF file) #3570

vooon opened this issue Jun 16, 2023 · 0 comments · Fixed by #3587
Assignees
Labels

Comments

@vooon
Copy link

vooon commented Jun 16, 2023

Summary
Traceback (most recent call last):
  File "/home/vovan/.cache/pypoetry/virtualenvs/foo-3I0hE4B9-py3.11/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vovan/.cache/pypoetry/virtualenvs/foo-3I0hE4B9-py3.11/lib/python3.11/site-packages/ansiblelint/__main__.py", line 312, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/home/vovan/.cache/pypoetry/virtualenvs/foo-3I0hE4B9-py3.11/lib/python3.11/site-packages/ansiblelint/__main__.py", line 291, in main
    app.render_matches(result.matches)
  File "/home/vovan/.cache/pypoetry/virtualenvs/foo-3I0hE4B9-py3.11/lib/python3.11/site-packages/ansiblelint/app.py", line 105, in render_matches
    with self.options.sarif_file.open("w", encoding="utf-8") as sarif_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AnsibleUnicode' object has no attribute 'open'
Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint 6.17.1 using ansible-core:2.15.0 ruamel-yaml:0.17.31 ruamel-yaml-clib:0.2.7
  • ansible installation method: poetry
  • ansible-lint installation method: poetry (pip)
[tool.poetry.dev-dependencies]
ansible-lint = { version = "^6", markers = "platform_system != 'Windows'" }
STEPS TO REPRODUCE
---
$ cat .ansible-lint
---
profile: production
sarif_file: ansible-lint.sarif

$ ansible-lint playbook.yml
Desired Behavior

Not to fail.

Actual Behavior

With any playbook i'm getting traceback because of sarif_file option.

@vooon vooon added bug new Triage required labels Jun 16, 2023
@audgirka audgirka removed the new Triage required label Jun 21, 2023
@audgirka audgirka self-assigned this Jun 21, 2023
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.

2 participants