summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ansible/plugins/lookup/__init__.py4
-rw-r--r--lib/ansible/plugins/lookup/first_found.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/ansible/plugins/lookup/__init__.py b/lib/ansible/plugins/lookup/__init__.py
index 908135a4c7..61bbea4505 100644
--- a/lib/ansible/plugins/lookup/__init__.py
+++ b/lib/ansible/plugins/lookup/__init__.py
@@ -102,7 +102,7 @@ class LookupBase(with_metaclass(ABCMeta, object)):
"""
pass
- def find_file_in_search_path(self, myvars, subdir, needle):
+ def find_file_in_search_path(self, myvars, subdir, needle, ignore_missing=False):
'''
Return a file (needle) in the task's expected search path.
'''
@@ -113,7 +113,7 @@ class LookupBase(with_metaclass(ABCMeta, object)):
paths = self.get_basedir(myvars)
result = self._loader.path_dwim_relative_stack(paths, subdir, needle)
- if result is None:
+ if result is None and not ignore_missing:
self._display.warning("Unable to find '%s' in expected paths." % needle)
return result
diff --git a/lib/ansible/plugins/lookup/first_found.py b/lib/ansible/plugins/lookup/first_found.py
index 4fb7e35ea2..43fc3a7a77 100644
--- a/lib/ansible/plugins/lookup/first_found.py
+++ b/lib/ansible/plugins/lookup/first_found.py
@@ -181,7 +181,7 @@ class LookupModule(LookupBase):
# get subdir if set by task executor, default to files otherwise
subdir = getattr(self, '_subdir', 'files')
path = None
- path = self.find_file_in_search_path(variables, subdir, fn)
+ path = self.find_file_in_search_path(variables, subdir, fn, ignore_missing=True)
if path is not None:
return [path]
else: