unified boolean function

optimized boolean function
fixes #17815
This commit is contained in:
Brian Coca 2016-11-22 15:50:24 -05:00 committed by Brian Coca
commit ca1514cf2a
17 changed files with 23 additions and 54 deletions

View file

@ -32,15 +32,13 @@ from ansible.utils.path import makedirs_safe
BOOL_TRUE = frozenset([ "true", "t", "y", "1", "yes", "on" ])
# copied from utils, avoid circular reference fun :)
def mk_boolean(value):
if value is None:
return False
val = str(value)
if val.lower() in BOOL_TRUE:
return True
else:
return False
ret = value
if not isinstance(value, bool):
if value is None:
ret = False
ret = (str(value).lower() in BOOL_TRUE)
return ret
def shell_expand(path, expand_relative_paths=False):
'''