1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #362 from jhoekx/uppercase-vars

Allow camelCase variables in varReplace.
This commit is contained in:
Michael DeHaan 2012-05-11 10:06:21 -07:00
commit 36639186e0
2 changed files with 11 additions and 1 deletions

View file

@ -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())

View file

@ -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 = {