vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.69k stars 411 forks source link

Improve jinja spacing #413

Closed pa-decarvalho closed 1 year ago

pa-decarvalho commented 1 year ago

This pull request aims to improve jinja spacing. To achieve this, the jinja[spacing] section has been removed from the .config/ansible-lint.yml file.

While making the correction, I came across the following variable | bool and decided to remove all | bool occurrences from the project as they are not necessary. Feel free to let me know if I should create another PR for this part or revert the change.

vitabaks commented 1 year ago

@pa-decarvalho

First and foremost, thank you for your contribution to the project. Your efforts towards improving jinja spacing are greatly appreciated, and your attention to detail is commendable.

However, I'd like to bring up the topic of removing all | bool occurrences. The use of the | bool filter in Ansible is considered a good practice. It ensures consistent boolean interpretation across various possible representations, such as "True", "true", "yes", "on", "1", etc. The | bool filter ensures these values are interpreted in their boolean representation, facilitating comparisons and usage in conditionals among others.

If you've encountered a situation where | bool is misused or not needed, that might indeed be a case for correction. But removing all occurrences of | bool without appropriate analysis and evaluation might lead to unforeseen consequences.

Looking forward to your thoughts on this.

cc @ThomasSanson

pa-decarvalho commented 1 year ago

@vitabaks

I didn't know that | bool was a good practice. Usually, when I work on an Ansible project, all the linters are active, and values other than true and false are not allowed for booleans (like yes, 1...)

I will immediately replace all occurrences of | bool to avoid any unpleasant surprises.

vitabaks commented 1 year ago

@ThomasSanson What do you think about bool filter?

pa-decarvalho commented 1 year ago

@ThomasSanson What do you think about bool filter?

@vitabaks @ThomasSanson

I am in the process of reverting back regarding the bool filter and correcting only lint errors (I am waiting for the tests to pass locally).

If you agree, I can create an issue for us to discuss the pros and cons of using it.

vitabaks commented 1 year ago

thread for discussion of the bool filter https://github.com/vitabaks/postgresql_cluster/discussions/415