Commit abb391f3 by Michael DeHaan

Merge pull request #362 from jhoekx/uppercase-vars

Allow camelCase variables in varReplace.
parents 277ff4f5 0b5b4485
...@@ -243,7 +243,7 @@ def varReplace(raw, vars): ...@@ -243,7 +243,7 @@ def varReplace(raw, vars):
# Determine replacement value (if unknown variable then preserve # Determine replacement value (if unknown variable then preserve
# original) # original)
varname = m.group(2).lower() varname = m.group(2)
replacement = unicode(varLookup(varname, vars) or m.group()) replacement = unicode(varLookup(varname, vars) or m.group())
......
...@@ -45,6 +45,16 @@ class TestUtils(unittest.TestCase): ...@@ -45,6 +45,16 @@ class TestUtils(unittest.TestCase):
assert res == 'hello world' 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): def test_varReplace_middle(self):
template = 'hello $who!' template = 'hello $who!'
vars = { vars = {
......
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