Address ansible-lint E602 error "Don't compare to empty string" with the
test | length > 0.
The filter | bool gives the boolean value True only if the string is
one of "true", "True", "yes", "1", or other strings meaning
True. Any other non-empty string is translated to False.
The current recommended solution, to use the bare variable, gives
deprecation warnings now.
Address ansible-lint E602 error "Don't compare to empty string" with the test
| length > 0
.The filter
| bool
gives the boolean valueTrue
only if the string is one of"true"
,"True"
,"yes"
,"1"
, or other strings meaningTrue
. Any other non-empty string is translated toFalse
.The current recommended solution, to use the bare variable, gives deprecation warnings now.
After reading the related discussions, this might be the current best workaround: https://github.com/ansible/ansible-lint/issues/457 https://stackoverflow.com/a/59085721
Keep legitimate uses of
| bool
in access-check scripts.