ansible-community / ansible-vault

:key: Ansible role for Hashicorp Vault
BSD 2-Clause "Simplified" License
364 stars 194 forks source link

Stop concatenating spaces in templating logic. #307

Open deekayen opened 2 years ago

deekayen commented 2 years ago

The spaces before each template block are adding together to make the final product output file indenting excessive. Opting here for final readability instead of templating readability.

gardar commented 2 years ago

I think the indenting in the template might be there to make the template easier to read. It's a common practice to have the same indent level for the opening and closing tags of a jinja2 statement to be able to quickly realize where the statement begins/ends. But I agree that it's definitely not something that should translate into the file that's generated from the template.

I wonder if the lstrip_blocks or trim_blocks parameters of the template module might fix the issue instead of removing the indentation from the template (and making it harder on the eyes). It's also probably possible to fix the whitespace issue by using the minus sign ( {%- %} ) in some of the affected jinja2 statements, see: https://jinja.palletsprojects.com/en/3.0.x/templates/#whitespace-control

bbaassssiiee commented 2 years ago

This branch has conflicts that must be resolved