Fix some templating issues, needs testing with anti-unicode safeguard around shlex.split

This commit is contained in:
Michael DeHaan 2012-08-02 20:21:59 -04:00
parent bd7de28a64
commit b76efa39be
3 changed files with 6 additions and 5 deletions

View file

@ -204,7 +204,7 @@ def template(text, vars):
if (depth > 20):
raise errors.AnsibleError("template recursion depth exceeded")
prev_text = text
text = varReplace(unicode(text), vars)
text = varReplace(unicode(text), vars)
return text
def template_from_file(basedir, path, vars):
@ -238,10 +238,11 @@ def parse_kv(args):
options = {}
if args is not None:
vargs = shlex.split(args, posix=True)
# attempting to split a unicode here does bad things
vargs = shlex.split(str(args), posix=True)
for x in vargs:
if x.find("=") != -1:
k, v = x.split("=", 1)
k, v = x.split("=",1)
options[k]=v
return options