mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-29 22:01:27 -07:00
Make listify respect the global setting for undefined variables.
(Fixes #9008.)
With credit to jimi-c for the initial pass in this commit:
b18bd6b98e
This commit is contained in:
parent
bbd9921dbd
commit
2769098fe7
2 changed files with 13 additions and 1 deletions
|
@ -541,11 +541,20 @@ class TestUtils(unittest.TestCase):
|
|||
|
||||
def test_listify_lookup_plugin_terms(self):
|
||||
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'])
|
||||
|
||||
# Variable interpolation
|
||||
self.assertEqual(ansible.utils.listify_lookup_plugin_terms('things', basedir, dict(things=['{{ foo }}', '{{ bar }}'], foo="hello", bar="world")),
|
||||
['hello', 'world'])
|
||||
with self.assertRaises(ansible.errors.AnsibleError) as ex:
|
||||
ansible.utils.listify_lookup_plugin_terms('things', basedir, dict(things=['{{ foo }}', '{{ bar_typo }}'], foo="hello", bar="world"))
|
||||
self.assertTrue("undefined variable in items: 'bar_typo'" in ex.exception.msg)
|
||||
|
||||
def test_deprecated(self):
|
||||
sys_stderr = sys.stderr
|
||||
sys.stderr = StringIO.StringIO()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue