mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Convert boolean strings from set_fact to proper boolean values
Also adds integration tests for booleanification of strings Fixes #8629
This commit is contained in:
parent
8708a00cbd
commit
a571fd4efe
3 changed files with 93 additions and 1 deletions
|
@ -32,6 +32,16 @@ class ActionModule(object):
|
|||
options = {}
|
||||
if complex_args:
|
||||
options.update(complex_args)
|
||||
options.update(utils.parse_kv(module_args))
|
||||
|
||||
# parse the k=v arguments and convert any special boolean
|
||||
# strings into proper booleans (issue #8629)
|
||||
parsed_args = utils.parse_kv(module_args)
|
||||
for k,v in parsed_args.iteritems():
|
||||
# convert certain strings to boolean values
|
||||
if isinstance(v, basestring) and v.lower() in ('true', 'false', 'yes', 'no'):
|
||||
parsed_args[k] = utils.boolean(v)
|
||||
|
||||
# and finally update the options with the parsed/modified args
|
||||
options.update(parsed_args)
|
||||
|
||||
return ReturnData(conn=conn, result=dict(ansible_facts=options))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue