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

pull/14290/head
Matt Martz 9 years ago
parent 7f2bc082fa
commit d7a6ccc4c2

@ -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

Loading…
Cancel
Save