summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2012-08-02 20:21:59 -0400
committerMichael DeHaan <michael.dehaan@gmail.com>2012-08-02 20:21:59 -0400
commitb76efa39be063dd15da8d4eabc310eb0f673e295 (patch)
treecf2b3f8c691dd1d0edbd018d98bec2937005083a
parentbd7de28a649bf609773aa6bbd7a58a519bd5479e (diff)
downloadansible-b76efa39be063dd15da8d4eabc310eb0f673e295.tar.gz
Fix some templating issues, needs testing with anti-unicode safeguard around shlex.split
-rw-r--r--lib/ansible/playbook/task.py2
-rw-r--r--lib/ansible/runner/__init__.py2
-rw-r--r--lib/ansible/utils.py7
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py
index 8ecebf1070..63dd200639 100644
--- a/lib/ansible/playbook/task.py
+++ b/lib/ansible/playbook/task.py
@@ -83,7 +83,7 @@ class Task(object):
import_tags = import_tags.split(",")
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
if self.with_items is not None and self.first_available_file is not None:
diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py
index f88e016f43..ee452e4325 100644
--- a/lib/ansible/runner/__init__.py
+++ b/lib/ansible/runner/__init__.py
@@ -548,6 +548,7 @@ class Runner(object):
for (k,v) in self.module_args.iteritems():
new_args = new_args + "%s='%s' " % (k,v)
self.module_args = new_args
+ self.module_args = utils.template(self.module_args, inject)
conditional = utils.template(self.conditional, inject)
if not eval(conditional):
@@ -586,7 +587,6 @@ class Runner(object):
changed = False
if result.result.get('changed',False) or result2.result.get('changed',False):
changed = True
- # print "DEBUG=%s" % changed
result2.result.update(result.result)
result2.result['changed'] = changed
result = result2
diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py
index 4d4d7fa96a..c83329eead 100644
--- a/lib/ansible/utils.py
+++ b/lib/ansible/utils.py
@@ -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