Don't check for var._obj in template._clean_data (#20868)

* Don't check for var._obj in template._clean_data

AnsibleUnsafe or other unsafe vars used to have a
'_obj' slot but no longer do. This was causing attribute
errors if a object was 'unsafe' but not a string.

Add tests for AnsibleUnsafe, lookups, and AnsibleContext
This commit is contained in:
Adrian Likins
2017-02-08 16:09:34 -05:00
committed by GitHub
parent e511326222
commit df3e4cd7f4
2 changed files with 365 additions and 20 deletions

View File

@@ -345,11 +345,7 @@ class Templar:
if hasattr(variable, '__UNSAFE__'):
if isinstance(variable, text_type):
rval = self._clean_data(variable)
else:
# Do we need to convert these into text_type as well?
# return self._clean_data(to_text(variable._obj, nonstring='passthru'))
rval = self._clean_data(variable._obj)
return rval
return rval
try:
if convert_bare: