From 0b5b44858e8e0cd84a24659612c8e9683df592f2 Mon Sep 17 00:00:00 2001 From: Jeroen Hoekx Date: Fri, 11 May 2012 14:14:53 +0200 Subject: [PATCH] Allow camelCase variables in varreplace. --- lib/ansible/utils.py | 2 +- test/TestUtils.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py index 6c1e3be6a1e..29b164de910 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 aeabdb0dbb7..114ac71c0a0 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 = {