1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Use isinstance type checks in bool filter so we can handle unsafe proxy objects. Fixes #14240

This commit is contained in:
Matt Martz 2016-02-01 12:32:59 -06:00
parent 25f403d36d
commit ddfab5faf1

View file

@ -41,7 +41,7 @@ import uuid
import yaml import yaml
from jinja2.filters import environmentfilter from jinja2.filters import environmentfilter
from distutils.version import LooseVersion, StrictVersion from distutils.version import LooseVersion, StrictVersion
from ansible.compat.six import iteritems from ansible.compat.six import iteritems, string_types
from ansible import errors from ansible import errors
from ansible.parsing.yaml.dumper import AnsibleDumper from ansible.parsing.yaml.dumper import AnsibleDumper
@ -110,7 +110,7 @@ def bool(a):
''' return a bool for the arg ''' ''' return a bool for the arg '''
if a is None or type(a) == bool: if a is None or type(a) == bool:
return a return a
if type(a) in types.StringTypes: if isinstance(a, string_types):
a = a.lower() a = a.lower()
if a in ['yes', 'on', '1', 'true', 1]: if a in ['yes', 'on', '1', 'true', 1]:
return True return True