mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 11:40:22 -07:00
fixed first_available_found for template, refactored into common function
added deprecation warning fixed display.deprecated to make version optional (code already assumed this) turned warning + 'deprecated' in plugin loader into actual call to deprecated()
This commit is contained in:
parent
ba7243c5f9
commit
5a5b7ff561
5 changed files with 30 additions and 34 deletions
|
@ -74,20 +74,8 @@ class ActionModule(ActionBase):
|
|||
# if we have first_available_file in our vars
|
||||
# look up the files and use the first one we find as src
|
||||
elif faf:
|
||||
#FIXME: issue deprecation warning for first_available_file, use with_first_found or lookup('first_found',...) instead
|
||||
found = False
|
||||
for fn in faf:
|
||||
fn_orig = fn
|
||||
fnt = self._templar.template(fn)
|
||||
fnd = self._loader.path_dwim_relative(self._task._role._role_path, 'files', fnt)
|
||||
of = task_vars.get('_original_file', None)
|
||||
if not os.path.exists(fnd) and of is not None:
|
||||
fnd = self._loader.path_dwim_relative(of, 'files', of)
|
||||
if os.path.exists(fnd):
|
||||
source = fnd
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
source = self._get_first_available_file(faf, task_vars.get('_original_file', None))
|
||||
if source is None:
|
||||
return dict(failed=True, msg="could not find src in first_available_file list")
|
||||
else:
|
||||
if self._task._role is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue