mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Don't perform string to bool conversion in set_fact when jinja2 native types is enabled (#43425)
* Don't perform string to bool conversion in set_fact when jinja2 native types is enabled. Fixes #42599 * Add tests for boolean conversions in set_fact
This commit is contained in:
parent
43c508b3c3
commit
77d2008150
4 changed files with 47 additions and 1 deletions
|
@ -23,6 +23,8 @@ from ansible.module_utils.parsing.convert_bool import boolean
|
|||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.vars import isidentifier
|
||||
|
||||
import ansible.constants as C
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
||||
|
@ -49,7 +51,7 @@ class ActionModule(ActionBase):
|
|||
"letters, numbers and underscores." % k)
|
||||
return result
|
||||
|
||||
if isinstance(v, string_types) and v.lower() in ('true', 'false', 'yes', 'no'):
|
||||
if not C.DEFAULT_JINJA2_NATIVE and isinstance(v, string_types) and v.lower() in ('true', 'false', 'yes', 'no'):
|
||||
v = boolean(v, strict=False)
|
||||
facts[k] = v
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue