mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixes #5059 Ignore lookup failures when templating a task name
This commit is contained in:
parent
21054798a5
commit
2a976ac313
1 changed files with 8 additions and 2 deletions
|
@ -88,8 +88,14 @@ def lookup(name, *args, **kwargs):
|
||||||
vars = kwargs.get('vars', None)
|
vars = kwargs.get('vars', None)
|
||||||
|
|
||||||
if instance is not None:
|
if instance is not None:
|
||||||
ran = instance.run(*args, inject=vars, **kwargs)
|
# safely catch run failures per #5059
|
||||||
return ",".join(ran)
|
try:
|
||||||
|
ran = instance.run(*args, inject=vars, **kwargs)
|
||||||
|
except Exception, e:
|
||||||
|
ran = None
|
||||||
|
if ran:
|
||||||
|
ran = ",".join(ran)
|
||||||
|
return ran
|
||||||
else:
|
else:
|
||||||
raise errors.AnsibleError("lookup plugin (%s) not found" % name)
|
raise errors.AnsibleError("lookup plugin (%s) not found" % name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue