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
The Jinja white-space control generates an jinja [spacing] rule violation.
I'm trying to escape this rule for a variable definition, but it seems that the escape is ignored.
I've tried to place the # noqa: jinja[spacing] mutation in several places, but it is always ignored.
Issue Type
Bug Report
OS / ENVIRONMENT
$ ansible-lint --versionansible-lint 6.22.1 using ansible-core:2.16.0 ansible-compat:4.1.10 ruamel-yaml:0.18.5 ruamel-yaml-clib:0.2.7
ansible installation method: pip
ansible-lint installation method: pip
STEPS TO REPRODUCE
Defined a variable as follow and try to ignore the jinja[spacing] rule:
foo_postgresql_grafana_password_encoded: >- # noqa: jinja[spacing] {% if '!' in foo_postgresql_grafana_password or '#' in foo_postgresql_grafana_password %} {{- ('\"\"\"' + foo_postgresql_grafana_password + '\"\"\"') | b64encode -}} {% else %} {{- foo_postgresql_grafana_password | b64encode -}} {% endif %}
or
# noqa: jinja[spacing]foo_postgresql_grafana_password_encoded: >- {% if '!' in foo_postgresql_grafana_password or '#' in foo_postgresql_grafana_password %} {{- ('\"\"\"' + foo_postgresql_grafana_password + '\"\"\"') | b64encode -}} {% else %} {{- foo_postgresql_grafana_password | b64encode -}} {% endif %}
Desired Behavior
The jinja[spacing] rule is ignored
Actual Behavior
The jinja[spacing] rule is not ignored
The text was updated successfully, but these errors were encountered:
I'm affected by the same issue in exactly the same situation. I've found a workaround: Use |- instead of >-, and make all jinja tags remove whitespace (i.e. use {%- -%} rather than {% %}. That way, whitespace is still removed, but by Jinja rather than by the YAML parser.
So, in your example:
foo_postgresql_grafana_password_encoded: |- {%- if '!' in foo_postgresql_grafana_password or '#' in foo_postgresql_grafana_password -%} {{- ('\"\"\"' + foo_postgresql_grafana_password + '\"\"\"') | b64encode -}} {%- else -%} {{- foo_postgresql_grafana_password | b64encode -}} {%- endif -%}
Summary
The Jinja white-space control generates an jinja [spacing] rule violation.
I'm trying to escape this rule for a variable definition, but it seems that the escape is ignored.
I've tried to place the # noqa: jinja[spacing] mutation in several places, but it is always ignored.
Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
Defined a variable as follow and try to ignore the jinja[spacing] rule:
or
Desired Behavior
The jinja[spacing] rule is ignored
Actual Behavior
The jinja[spacing] rule is not ignored
The text was updated successfully, but these errors were encountered: