From d7a6ccc4c2685e463e2705e78dccd63d40e3ecff Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 1 Feb 2016 12:32:59 -0600 Subject: [PATCH] Use isinstance type checks in bool filter so we can handle unsafe proxy objects. Fixes #14240 --- lib/ansible/plugins/filter/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/filter/core.py b/lib/ansible/plugins/filter/core.py index 8180f10e846..41d50f6fc9c 100644 --- a/lib/ansible/plugins/filter/core.py +++ b/lib/ansible/plugins/filter/core.py @@ -41,7 +41,7 @@ import uuid import yaml from jinja2.filters import environmentfilter 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.parsing.yaml.dumper import AnsibleDumper @@ -110,7 +110,7 @@ def bool(a): ''' return a bool for the arg ''' if a is None or type(a) == bool: return a - if type(a) in types.StringTypes: + if isinstance(a, string_types): a = a.lower() if a in ['yes', 'on', '1', 'true', 1]: return True