Commit c1fe0dd7 by Michael DeHaan

Quote long variables in playbooks when feeding them to the setup command

parent 5371a9e4
...@@ -449,7 +449,7 @@ class PlayBook(object): ...@@ -449,7 +449,7 @@ class PlayBook(object):
# magic in Runner() # magic in Runner()
push_var_str='' push_var_str=''
for (k,v) in vars.iteritems(): for (k,v) in vars.iteritems():
push_var_str += "%s=%s " % (k,v) push_var_str += "%s=\"%s\" " % (k,v)
# push any variables down to the system # push any variables down to the system
setup_results = ansible.runner.Runner( setup_results = ansible.runner.Runner(
......
...@@ -117,3 +117,7 @@ class TestRunner(unittest.TestCase): ...@@ -117,3 +117,7 @@ class TestRunner(unittest.TestCase):
print utils.bigjson(actual) print utils.bigjson(actual)
assert cmp(expected, actual) == 0, "expected events match actual events" assert cmp(expected, actual) == 0, "expected events match actual events"
# make sure the template module took options from the vars section
data = file('/tmp/ansible_test_data_template.out').read()
assert data.find("ears") != -1, "template success"
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
--- ---
- hosts: all - hosts: all
vars: vars:
answer: "???" answer: "Wuh, I think so, Brain, but if we didn't have ears, we'd look like weasels."
port: 5150 port: 5150
tasks: tasks:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment