Allow camelCase variables in varreplace.
This commit is contained in:
parent
4e65b537da
commit
0b5b44858e
2 changed files with 11 additions and 1 deletions
|
@ -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):
|
||||||
|
|
||||||
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 = {
|
||||||
|
|
Loading…
Reference in a new issue