mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Consolidate boolean/mk_boolean conversion functions into a single location
Consolidate the module_utils, constants, and config functions that convert values into booleans into a single function in module_utils. Port code to use the module_utils.validate.convert_bool.boolean function isntead of mk_boolean.
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.constants import mk_boolean as boolean
|
||||
from ansible.module_utils.six import iteritems, string_types
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.vars import isidentifier
|
||||
|
||||
@@ -53,7 +53,7 @@ class ActionModule(ActionBase):
|
||||
val = self._task.args.get(opt, None)
|
||||
if val is not None:
|
||||
if not isinstance(val, bool):
|
||||
stats[opt] = boolean(self._templar.template(val))
|
||||
stats[opt] = boolean(self._templar.template(val), strict=False)
|
||||
else:
|
||||
stats[opt] = val
|
||||
|
||||
|
||||
Reference in New Issue
Block a user