minor fixes to template function

- make sure it calls itself correctly, now passes same params as it recieves
- vars is reserved, changed for templatevars to avoid confustion
- forcing mustaches again since the removal broke 'listification' as per #9622
- fixes incorrectly successful tests using undefined var, now it is defined
- now returns empty list if items is None to avoid errors
This commit is contained in:
Brian Coca 2014-11-25 11:23:22 -05:00
parent d36c38c35e
commit 7d2937b1cc
4 changed files with 25 additions and 24 deletions

View file

@ -568,10 +568,8 @@ class TestUtils(unittest.TestCase):
basedir = os.path.dirname(__file__)
# Straight lookups
self.assertEqual(ansible.utils.listify_lookup_plugin_terms('things', basedir, dict()),
['things'])
self.assertEqual(ansible.utils.listify_lookup_plugin_terms('things', basedir, dict(things=['one', 'two'])),
['one', 'two'])
self.assertEqual(ansible.utils.listify_lookup_plugin_terms('things', basedir, dict(things=[])), [])
self.assertEqual(ansible.utils.listify_lookup_plugin_terms('things', basedir, dict(things=['one', 'two'])), ['one', 'two'])
# Variable interpolation
self.assertEqual(ansible.utils.listify_lookup_plugin_terms('things', basedir, dict(things=['{{ foo }}', '{{ bar }}'], foo="hello", bar="world")),