summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2012-05-11 10:06:21 -0700
committerMichael DeHaan <michael.dehaan@gmail.com>2012-05-11 10:06:21 -0700
commit36639186e0d25f2da300c75f23587bec34fd7004 (patch)
treeccff406473803c1626d8c3f43268f25daeecf9e3
parent291de4f3b483bd52dab9c3bd24efb0b43b6c8b7e (diff)
parentdc60f2d844d3ef5a2289d42472b686c009654ca3 (diff)
downloadansible-36639186e0d25f2da300c75f23587bec34fd7004.tar.gz
Merge pull request #362 from jhoekx/uppercase-vars
Allow camelCase variables in varReplace.
-rw-r--r--lib/ansible/utils.py2
-rw-r--r--test/TestUtils.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py
index 6c1e3be6a1..29b164de91 100644
--- a/lib/ansible/utils.py
+++ b/lib/ansible/utils.py
@@ -243,7 +243,7 @@ def varReplace(raw, vars):
# Determine replacement value (if unknown variable then preserve
# original)
- varname = m.group(2).lower()
+ varname = m.group(2)
replacement = unicode(varLookup(varname, vars) or m.group())
diff --git a/test/TestUtils.py b/test/TestUtils.py
index aeabdb0dbb..114ac71c0a 100644
--- a/test/TestUtils.py
+++ b/test/TestUtils.py
@@ -45,6 +45,16 @@ class TestUtils(unittest.TestCase):
assert res == 'hello world'
+ def test_varReplace_caps(self):
+ template = 'hello $whoVar'
+ vars = {
+ 'whoVar': 'world',
+ }
+
+ res = ansible.utils.varReplace(template, vars)
+ print res
+ assert res == 'hello world'
+
def test_varReplace_middle(self):
template = 'hello $who!'
vars = {