mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
no need for warnings in first_found
This commit is contained in:
parent
54ce6a9b7a
commit
125a8d3c65
2 changed files with 3 additions and 3 deletions
|
@ -102,7 +102,7 @@ class LookupBase(with_metaclass(ABCMeta, object)):
|
||||||
"""
|
"""
|
||||||
pass
|
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.
|
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)
|
paths = self.get_basedir(myvars)
|
||||||
|
|
||||||
result = self._loader.path_dwim_relative_stack(paths, subdir, needle)
|
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)
|
self._display.warning("Unable to find '%s' in expected paths." % needle)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -181,7 +181,7 @@ class LookupModule(LookupBase):
|
||||||
# get subdir if set by task executor, default to files otherwise
|
# get subdir if set by task executor, default to files otherwise
|
||||||
subdir = getattr(self, '_subdir', 'files')
|
subdir = getattr(self, '_subdir', 'files')
|
||||||
path = None
|
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:
|
if path is not None:
|
||||||
return [path]
|
return [path]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue