-
Notifications
You must be signed in to change notification settings - Fork 9
[Vote ended on 2022-08-03] Disconnect between Docs and Ansible-lint in regards to truthy statements (booleans) #116
Comments
We had a short discussion on this on June 24th, 2021. In there, some links were burried out:
The last meeting ended with an action "create a proposal for creating consistency in the boolean values", which I think didn't happen. |
Thanks for raising this. I know the current situation is confusing. I've asked @cidrblock to take a look at this, he's one of the Ansible Architects, and responsible for ansible-lint. He's on holiday though and should be back next week. |
Regardless of ansible-lint, we should decide again whether that 'user-friendly' override to yes/no is actually user-friendly. We also failed to update text/examples beyond the boolean. Here is an example where the text talks about |
Another older PR closed that proposed true/false consistency - ansible/ansible#49072 |
It was agreed in the DaWGs (Docs working group) meeting to back out the docs override that is forcing all boolean parameters to say |
Of note here, and not that it couldn't change, but the core team had discussed that if we started supporting YAML 1.2, we would likely add support back in for 1.1 booleans. Also one reason that lint has problems is that it's using |
I'm inclined to suggest we consistently use true/false while continuing to support the older yaml 1.1 variants in ansible/ansible. Some reasons include:
WRT ansible-lint, taken from the docs "The goal of ansible-lint is to ensure the content created by different people has a similar look and feel. This makes the adoption and use of Ansible content easier in the community and enterprise. By keeping the number of configurable features at a minimum, consistent outcomes between authors can be achieved." https://ansible-lint.readthedocs.io/en/latest/philosophy/ This is the main reason why ansible-lint typically suggests one way to do something but still allows for customization by enabling/disabling rules so an organization can make and adhere to a custom rule set. I'm going to guess it will be a long time before ansible/ansible would drop support for the YAML 1.1 variants but since we can't influence the entire eco-system of tools and systems ansible interacts with, true/false reflecting the YAML 1.2 specification seems to be the best path forward to maintain consistency. |
@cidrblock I think you have some strong arguments there for using Considering your last argument (Fewer surprises when using yaml libraries across multiple languages) I would contest that |
Python uses YAML 1.2 also requires a pragma at the start of any document, since most playbooks don't have it they should be interpreted as 1.1 in any case. |
Yep, but |
Except Python also takes as false |
And how exactly is this a reason to use
Whatever Ansible does internally, it accepts |
From the documentation perspective, we are leaning toward |
Adding...it wasn't an override from docs as i thought - documentation has to decide what to put in the output for boolean, so we chose yes/no back in 2018. |
I think we should have a vote on this, with options maybe being a) |
@mariolenz I'm not advocating for either, just pointing out the holes in your argument. IMHO documentation should favor 'the accepted way' of doing things, but should not exclude the other ways since that will then cause users to be surprised and commit errors when encountering other forms (for example the YAML Norway ISO issue ...). In this case |
I don't see a hole in the argument. Just because Python (and many other languages) evaluate a lot of things to True or False, if people want to express a Boolean, that is a yes/no value, they usually use True or False. At least in the scripting and programming languages that I know. Even SQL uses TRUE and FALSE. And I think PowerShell uses In GUIs, you often find yes and no. But in text-based tools, I mainly know true and false... well, with differences in uppercase / lowercase and, in PowerShell, an added $ in front.
For me, 'the accepted way' to express Boolean values is true and false. Of course, it should be documented that Btw: I've never heard of the YAML Norway ISO issue, but it sounds interesting. I'll try to find the time and look it up. Thanks!
Apart from my personal opinion: The more people using ansible-lint, the more 'the accepted way' might move into the direction of using |
Your point was building on cidr's that true/false normalized to Python standards , only reason i went down this rabbit hole. the norway issue:
no is the ISO for Norway, YAML instead returns a boolean false unless you |
Suggestion for a vote formulation: https://gist.github.com/felixfontein/9e532485a081266e6e98d9f0469583d2 I will likely create a vote after today's meeting, so if you want something changed, please comment there until then :) |
Sorry, maybe I've expressed myself poorly. I don't want to normalize to Python standards. I just wanted to say that |
I created a vote on this in #120. Please vote there. If you want to discuss something, please do it here though :) |
Issues have been opened for collections so going to close this and thanks everyone for the help! |
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None>
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None>
…nsible-community/community-topics#116). This was changed in ansible/ansible#78921 to use `true`/ `false`.
…nsible-community/community-topics#116). This was changed in ansible/ansible#78921 to use `true`/ `false`. Do not use release candidates or alpha releases in Jenkinsfiles
…nsible-community/community-topics#116). This was changed in ansible/ansible#78921 to use `true`/ `false`. Up-version blockdevmap.py with latest
…nity/community-topics#116). This was changed in ansible/ansible#78921 to use `true`/ `false`. Add examples.
…munity/community-topics#116). This was changed in ansible/ansible#78921 to use `true` or `false`. Do not use release candidates or alpha releases in Jenkinsfiles
…munity/community-topics#116). This was changed in ansible/ansible#78921 to use `true` or `false`. Do not use release candidates or alpha releases in Jenkinsfiles
…munity/community-topics#116). This was changed in ansible/ansible#78921 to use `true` or `false`. Do not use release candidates or alpha releases in Jenkinsfiles
Previous documentation defined booleans as `yes` or `no` (ansible-community/community-topics#116). This was changed in ansible/ansible#78921 to use `true` or `false`. Up-version blockdevmap.py with latest
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections@cb9716e
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cb9716e
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cb9716e
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cb9716e
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cb9716e
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cb9716e
adjust booleans: use true/false Depends-On: ansible-collections#1423 SUMMARY ansible-community/community-topics#116 ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections/community.aws@cb9716e
Hi everyone,
I had brought this up on Matrix and was asked to create an issue here after some discussion.
Summary
Currently, the Ansible Docs will always use yes/no for truthy statements.
However, Ansible-Lint will throw an error if yes/no is used and will enforce the use of true/false.
yaml: truthy value should be one of [false, true] (yaml[truthy])
This is rather inconsistent and (at least on my part) leads to confusion.
In a discussion on Matrix it was found that Ansible Docs & Automation Hub both enforce the use of yes/no use for truthy statements via an override.
Related issues (where this issue was also brought up, but wasnt followed up on):
ansible/ansible#77581
ansible/ansible-lint#1954
The text was updated successfully, but these errors were encountered: