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:
Toshio Kuratomi 2017-07-14 16:44:58 -07:00
parent f9c60e1a82
commit ff22528b07
30 changed files with 433 additions and 102 deletions

View file

@ -25,9 +25,9 @@ import os.path
import re
import tempfile
from ansible.constants import mk_boolean as boolean
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_native, to_text
from ansible.module_utils.parsing.convert_bool import boolean
from ansible.plugins.action import ActionBase
from ansible.utils.hashing import checksum_s
@ -101,7 +101,7 @@ class ActionModule(ActionBase):
result['msg'] = "src and dest are required"
return result
if boolean(remote_src):
if boolean(remote_src, strict=False):
result.update(self._execute_module(tmp=tmp, task_vars=task_vars))
return result
else: