mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Lookup plugin arguments need to be templated
This commit is contained in:
parent
44af1408ee
commit
e74ffd6764
2 changed files with 4 additions and 2 deletions
|
@ -157,6 +157,8 @@ def _varFind(basedir, text, vars, depth=0):
|
|||
if lookup_plugin_name == 'LOOKUP':
|
||||
lookup_plugin_name, args = args.split(",", 1)
|
||||
args = args.strip()
|
||||
# args have to be templated
|
||||
args = varReplace(basedir, args, vars, depth=depth+1, expand_lists=True)
|
||||
instance = utils.plugins.lookup_loader.get(lookup_plugin_name.lower(), basedir=basedir)
|
||||
if instance is not None:
|
||||
replacement = instance.run(args, inject=vars)
|
||||
|
|
|
@ -272,9 +272,9 @@ class TestUtils(unittest.TestCase):
|
|||
assert res == u'hello oh great one'
|
||||
|
||||
def test_varReplace_include(self):
|
||||
template = 'hello $FILE(world) $LOOKUP(file, world)'
|
||||
template = 'hello $FILE(world) $LOOKUP(file, $filename)'
|
||||
|
||||
res = ansible.utils.template("test", template, {}, expand_lists=True)
|
||||
res = ansible.utils.template("test", template, {'filename': 'world'}, expand_lists=True)
|
||||
|
||||
assert res == u'hello world world'
|
||||
|
||||
|
|
Loading…
Reference in a new issue