-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend boolean values section in playbooks_variables #1285
base: devel
Are you sure you want to change the base?
Conversation
Thanks for your Ansible docs contribution! We talk about Ansible documentation on matrix at #docs:ansible.im and on libera IRC at #ansible-docs if you ever want to join us and chat about the docs! We meet there on Tuesdays (see the Ansible calendar) and welcome additions to our weekly agenda items - scroll down to find the upcoming agenda and add a comment to put something new on that agenda. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @skilyazhnev
Co-authored-by: Don Naro <[email protected]>
Co-authored-by: Don Naro <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor nits but the rest LGTM
@ssbarnea and @bcoca Please take a minute to review the latest round of edits. The details seem good to me and I'd like to get them merged. Thanks again for the docs contribution @skilyazhnev |
Co-authored-by: Don Naro <[email protected]>
Co-authored-by: Don Naro <[email protected]>
Co-authored-by: Don Naro <[email protected]>
=============================================================================================== ==================================================================== | ||
``True`` , ``'true'`` , ``'t'`` , ``'yes'`` , ``'y'`` , ``'on'`` , ``'1'`` , ``1`` , ``1.0`` Truthy values | ||
================= ================= | ||
Valid values Description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really 'ansible native' but YAML that uses true
and false
and the rest of the list below, it would be 'more true' that True
and False
are the 'native' options as Ansible evaluation happens inside Python and those are the 'Python native booleans', this also depends on context as inside a {{ }}
expression it is Jinja doing the evaluation, which is again using Python under the hood.
|
||
=============================================================================================== ==================================================================== | ||
.. table:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bool filter, while is it Jinja, it is an Ansible customization which approximates (but does not really match) the YAML booleans, the table below is incorrect as this is the actual code:
if a is None or isinstance(a, bool):
return a
if isinstance(a, string_types):
a = a.lower()
if a in ('yes', 'on', '1', 'true', 1):
return True
return False
so it realy only converts 'matching True
' and everything else is False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though this is something I'm planning to fix so they are closer to YAML by default but can be 'pythonic' otherwise.
Note that YAML 1.2 drops all of the non-upper/lowercase-variant-true-false boolean variants, we may want to discourage people from using deprecated alternative boolean value styles. |
brlin-tw not an issue until 2 things happen:
While the first will possibly happen soon, the second will take a long time, so we can defer the change until the first actually happens. |
@bcoca What about adding a note that discourages the alternative boolean value styles and clearly stating that they will be deprecated in future? Is there anything else holding this PR up? |
| and clearly stating that they will be deprecated in future? will they? |
fair point. I reread your comment about pyyaml. what if we come up with some other phrasing to discourage the use of alternative boolean styles? I mean we do have a linter that already complains about anything other than |
The linter is expressing an opinion, it might not be the correct one for all contexts |
yeah, linters tend to be opinionated about things. I'm probably straying from the point, which is about using the @bcoca would it work to remove the "Using then we could show the example. of course I could trim down the details about using thanks. |
Hi @skilyazhnev We've made some changes to the underlying readthedocs project for this repository. I'm going to close and re-open this issue to kick off a new PR preview build. You might notice there will be two checks for readthedocs. One for The Thank you for your patience and understanding. Also thanks for your contribution to the Ansible documentation. If you have any questions or concerns, please do let us know either here, in the docs channel on Matrix, or in the Ansible forum. Cheers. |
Hello!
in continuation of this issue
#1279