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

rich.errors.MarkupError when task name has slashes in square brackets #2507

Closed
kostyaplis opened this issue Sep 28, 2022 · 1 comment · Fixed by #2510
Closed

rich.errors.MarkupError when task name has slashes in square brackets #2507

kostyaplis opened this issue Sep 28, 2022 · 1 comment · Fixed by #2510
Assignees
Labels

Comments

@kostyaplis
Copy link
Contributor

Summary

Affected formatter: rich
A task name including [/] will cause a fatal error in case of rule match.

Ansible and Ansible Lint details
$ ansible-lint --version
ansible-lint 6.7.0 using ansible 2.13.3
  • ansible-lint installation method: pip
STEPS TO REPRODUCE

Test playbook:

- name: Test
  hosts: localhost
  tasks:
    - name: create test folder [/tmp/test]
      ansible.builtin.file:
        path: /tmp/test
        state: directory
        mode: 0750
$ ansible-lint playbook-test.yml

WARNING  Listing 1 violation(s) that are fatal
Traceback (most recent call last):
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/lib/python3.10/site-packages/ansiblelint/__main__.py", line 307, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/lib/python3.10/site-packages/ansiblelint/__main__.py", line 247, in main
    app.render_matches(result.matches)
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/lib/python3.10/site-packages/ansiblelint/app.py", line 94, in render_matches
    console.print(self.formatter.format(match), highlight=False)
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/lib/python3.10/site-packages/rich/console.py", line 1647, in print
    renderables = self._collect_renderables(
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/lib/python3.10/site-packages/rich/console.py", line 1511, in _collect_renderables
    self.render_str(
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/lib/python3.10/site-packages/rich/console.py", line 1403, in render_str
    rich_text = render_markup(
  File "/Users/konstantinplis/.pyenv/versions/3.10.1/lib/python3.10/site-packages/rich/markup.py", line 161, in render
    raise MarkupError(
rich.errors.MarkupError: closing tag '[/tmp/test]' at position 265 doesn't match any open tag
Desired Behavior

No fatal error

Actual Behavior

Fatal error thrown

@kostyaplis kostyaplis added bug new Triage required labels Sep 28, 2022
@ssbarnea ssbarnea self-assigned this Sep 28, 2022
@ssbarnea
Copy link
Member

I will release a hotfix for it today, I know why is happening and we already have few other fixes merged.

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