|
|
|
|
@ -295,9 +295,10 @@ def legacy_varReplace(basedir, raw, vars, lookup_fatal=True, depth=0, expand_lis
|
|
|
|
|
|
|
|
|
|
# TODO: varname is misnamed here
|
|
|
|
|
|
|
|
|
|
def template(basedir, varname, vars, lookup_fatal=True, depth=0, expand_lists=True, convert_bare=False, fail_on_undefined=False):
|
|
|
|
|
def template(basedir, varname, vars, lookup_fatal=True, depth=0, expand_lists=True, convert_bare=False, fail_on_undefined=False, filter_fatal=True):
|
|
|
|
|
''' templates a data structure by traversing it and substituting for other data structures '''
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
if convert_bare and isinstance(varname, basestring):
|
|
|
|
|
first_part = varname.split(".")[0].split("[")[0]
|
|
|
|
|
if first_part in vars and '{{' not in varname and '$' not in varname:
|
|
|
|
|
@ -331,6 +332,11 @@ def template(basedir, varname, vars, lookup_fatal=True, depth=0, expand_lists=Tr
|
|
|
|
|
return d
|
|
|
|
|
else:
|
|
|
|
|
return varname
|
|
|
|
|
except errors.AnsibleFilterError:
|
|
|
|
|
if filter_fatal:
|
|
|
|
|
raise
|
|
|
|
|
else:
|
|
|
|
|
return varname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _jinja2_vars(object):
|
|
|
|
|
|