|
|
@ -177,8 +177,8 @@ def _varReplaceFilesAndPipes(basedir, raw, vars):
|
|
|
|
|
|
|
|
|
|
|
|
return ''.join(done)
|
|
|
|
return ''.join(done)
|
|
|
|
|
|
|
|
|
|
|
|
def varReplaceWithItems(basedir, varname, vars):
|
|
|
|
def template_ds(basedir, varname, vars):
|
|
|
|
''' helper function used by with_items '''
|
|
|
|
''' templates a data structure by traversing it and substituting for other data structures '''
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(varname, basestring):
|
|
|
|
if isinstance(varname, basestring):
|
|
|
|
m = _varFind(varname, vars)
|
|
|
|
m = _varFind(varname, vars)
|
|
|
@ -186,17 +186,17 @@ def varReplaceWithItems(basedir, varname, vars):
|
|
|
|
return varname
|
|
|
|
return varname
|
|
|
|
if m['start'] == 0 and m['end'] == len(varname):
|
|
|
|
if m['start'] == 0 and m['end'] == len(varname):
|
|
|
|
if m['replacement'] is not None:
|
|
|
|
if m['replacement'] is not None:
|
|
|
|
return varReplaceWithItems(basedir, m['replacement'], vars)
|
|
|
|
return template_ds(basedir, m['replacement'], vars)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return varname
|
|
|
|
return varname
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return template(basedir, varname, vars)
|
|
|
|
return template(basedir, varname, vars)
|
|
|
|
elif isinstance(varname, (list, tuple)):
|
|
|
|
elif isinstance(varname, (list, tuple)):
|
|
|
|
return [varReplaceWithItems(basedir, v, vars) for v in varname]
|
|
|
|
return [template_ds(basedir, v, vars) for v in varname]
|
|
|
|
elif isinstance(varname, dict):
|
|
|
|
elif isinstance(varname, dict):
|
|
|
|
d = {}
|
|
|
|
d = {}
|
|
|
|
for (k, v) in varname.iteritems():
|
|
|
|
for (k, v) in varname.iteritems():
|
|
|
|
d[k] = varReplaceWithItems(basedir, v, vars)
|
|
|
|
d[k] = template_ds(basedir, v, vars)
|
|
|
|
return d
|
|
|
|
return d
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return varname
|
|
|
|
return varname
|
|
|
|