Fix some templating issues, needs testing with anti-unicode safeguard around shlex.split
This commit is contained in:
parent
bd7de28a64
commit
b76efa39be
3 changed files with 6 additions and 5 deletions
|
@ -83,7 +83,7 @@ class Task(object):
|
||||||
import_tags = import_tags.split(",")
|
import_tags = import_tags.split(",")
|
||||||
|
|
||||||
self.name = utils.template(self.name, self.module_vars)
|
self.name = utils.template(self.name, self.module_vars)
|
||||||
self.action = utils.template(self.name, self.module_vars)
|
self.action = utils.template(self.action, self.module_vars)
|
||||||
|
|
||||||
# handle mutually incompatible options
|
# handle mutually incompatible options
|
||||||
if self.with_items is not None and self.first_available_file is not None:
|
if self.with_items is not None and self.first_available_file is not None:
|
||||||
|
|
|
@ -548,6 +548,7 @@ class Runner(object):
|
||||||
for (k,v) in self.module_args.iteritems():
|
for (k,v) in self.module_args.iteritems():
|
||||||
new_args = new_args + "%s='%s' " % (k,v)
|
new_args = new_args + "%s='%s' " % (k,v)
|
||||||
self.module_args = new_args
|
self.module_args = new_args
|
||||||
|
self.module_args = utils.template(self.module_args, inject)
|
||||||
|
|
||||||
conditional = utils.template(self.conditional, inject)
|
conditional = utils.template(self.conditional, inject)
|
||||||
if not eval(conditional):
|
if not eval(conditional):
|
||||||
|
@ -586,7 +587,6 @@ class Runner(object):
|
||||||
changed = False
|
changed = False
|
||||||
if result.result.get('changed',False) or result2.result.get('changed',False):
|
if result.result.get('changed',False) or result2.result.get('changed',False):
|
||||||
changed = True
|
changed = True
|
||||||
# print "DEBUG=%s" % changed
|
|
||||||
result2.result.update(result.result)
|
result2.result.update(result.result)
|
||||||
result2.result['changed'] = changed
|
result2.result['changed'] = changed
|
||||||
result = result2
|
result = result2
|
||||||
|
|
|
@ -204,7 +204,7 @@ def template(text, vars):
|
||||||
if (depth > 20):
|
if (depth > 20):
|
||||||
raise errors.AnsibleError("template recursion depth exceeded")
|
raise errors.AnsibleError("template recursion depth exceeded")
|
||||||
prev_text = text
|
prev_text = text
|
||||||
text = varReplace(unicode(text), vars)
|
text = varReplace(unicode(text), vars)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def template_from_file(basedir, path, vars):
|
def template_from_file(basedir, path, vars):
|
||||||
|
@ -238,10 +238,11 @@ def parse_kv(args):
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
if args is not None:
|
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:
|
for x in vargs:
|
||||||
if x.find("=") != -1:
|
if x.find("=") != -1:
|
||||||
k, v = x.split("=", 1)
|
k, v = x.split("=",1)
|
||||||
options[k]=v
|
options[k]=v
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue