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
commit ff22528b07
30 changed files with 433 additions and 102 deletions

View file

@ -168,7 +168,8 @@ except ImportError:
from time import time
from ansible.constants import get_config, mk_boolean
from ansible.constants import get_config
from ansible.module_utils.parsing.convert_bool import boolean
NON_CALLABLES = (basestring, bool, dict, int, list, type(None))
@ -288,7 +289,7 @@ def _list_into_cache(regions):
if not cbs_attachments[region]:
cbs = pyrax.connect_to_cloud_blockstorage(region)
for vol in cbs.list():
if mk_boolean(vol.bootable):
if boolean(vol.bootable, strict=False):
for attachment in vol.attachments:
metadata = vol.volume_image_metadata
server_id = attachment['server_id']