You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ubuntu 20.04.5 LTS on Windows 10 Pro WSL
Python 3.8.10
STEPS TO REPRODUCE
I am using the cisco.ios.ios_command to send CLI commands to Cisco IOS switches. Some of these commands require user input, often by simply confirming via carriage return.
The official documentation also shows this syntax (see last example): cisco.ios.ios_command module
The playbook itself is working as it should, however, ansible-lint complains about Jinja spacing when using the carriage return character (\r) as a value for the "answer" key.
The problem is not specific to this module, I just wanted to give a real-world use case. It can also be reproduced by simply printing a carriage return via ansible.builtin.debug:
---
- name: Test carriage return
hosts: switches
tasks:
- name: Test carriage return
ansible.builtin.debug:
msg: "\r"
Desired Behavior
No Jinja spacing error should be raised.
Actual Behavior
A Jina spacing error is raised when using a carriage return character (\r) as a key value.
The error is not raised for other special characters, such as \n (line feed) or \t (tab).
hoalex
changed the title
"Jinja2 spacing could be improved" error when using carriage return in key value
"Jinja2 spacing could be improved" error when using carriage return character in key value
Nov 11, 2022
I digged a little bit on this one and it seems to be a bug or limitation on jinja2 library, more exactly the lex() implementation which converts any \r int a \n when it does the tokenizations. I looks for environment settings that I could change to alter this behavior but i found none.
Summary
Issue Type
Ansible and Ansible Lint details
OS / ENVIRONMENT
Ubuntu 20.04.5 LTS on Windows 10 Pro WSL
Python 3.8.10
STEPS TO REPRODUCE
I am using the
cisco.ios.ios_command
to send CLI commands to Cisco IOS switches. Some of these commands require user input, often by simply confirming via carriage return.The official documentation also shows this syntax (see last example): cisco.ios.ios_command module
The playbook itself is working as it should, however, ansible-lint complains about Jinja spacing when using the carriage return character (
\r
) as a value for the "answer" key.The problem is not specific to this module, I just wanted to give a real-world use case. It can also be reproduced by simply printing a carriage return via
ansible.builtin.debug
:Desired Behavior
No Jinja spacing error should be raised.
Actual Behavior
A Jina spacing error is raised when using a carriage return character (
\r
) as a key value.The error is not raised for other special characters, such as
\n
(line feed) or\t
(tab).The text was updated successfully, but these errors were encountered: