diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 3ee0d621cb..e78b04e5d8 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -75,7 +75,6 @@ class Task(Base, Conditional, Taggable, Become): _delegate_to = FieldAttribute(isa='string') _delegate_facts = FieldAttribute(isa='bool', default=False) _failed_when = FieldAttribute(isa='list', default=[]) - _first_available_file = FieldAttribute(isa='list') _loop = FieldAttribute(isa='string', private=True, inherit=False) _loop_args = FieldAttribute(isa='list', private=True, inherit=False) _loop_control = FieldAttribute(isa='class', class_type=LoopControl, inherit=False) diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 434315417b..1a9805fbc0 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -792,29 +792,6 @@ class ActionBase(with_metaclass(ABCMeta, object)): display.debug(u"_low_level_execute_command() done: rc=%d, stdout=%s, stderr=%s" % (rc, out, err)) return dict(rc=rc, stdout=out, stdout_lines=out.splitlines(), stderr=err) - def _get_first_available_file(self, faf, of=None, searchdir='files'): - - display.deprecated("first_available_file, use with_first_found or lookup('first_found',...) instead") - for fn in faf: - fnt = self._templar.template(fn) - if self._task._role is not None: - lead = self._task._role._role_path - else: - lead = fnt - fnd = self._loader.path_dwim_relative(lead, searchdir, fnt) - - if not os.path.exists(fnd) and of is not None: - if self._task._role is not None: - lead = self._task._role._role_path - else: - lead = of - fnd = self._loader.path_dwim_relative(lead, searchdir, of) - - if os.path.exists(fnd): - return fnd - - return None - def _get_diff_data(self, destination, source, task_vars, source_file=True): diff = {} diff --git a/lib/ansible/plugins/action/copy.py b/lib/ansible/plugins/action/copy.py index 40de82f4e3..d743887c68 100644 --- a/lib/ansible/plugins/action/copy.py +++ b/lib/ansible/plugins/action/copy.py @@ -44,15 +44,14 @@ class ActionModule(ActionBase): dest = self._task.args.get('dest', None) raw = boolean(self._task.args.get('raw', 'no')) force = boolean(self._task.args.get('force', 'yes')) - faf = self._task.first_available_file remote_src = boolean(self._task.args.get('remote_src', False)) follow = boolean(self._task.args.get('follow', False)) - if (source is None and content is None and faf is None) or dest is None: + if (source is None and content is None) or dest is None: result['failed'] = True result['msg'] = "src (or content) and dest are required" return result - elif (source is not None or faf is not None) and content is not None: + elif source is not None and content is not None: result['failed'] = True result['msg'] = "src and content are mutually exclusive" return result @@ -86,8 +85,6 @@ 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: - source = self._get_first_available_file(faf, task_vars.get('_original_file', None)) elif remote_src: result.update(self._execute_module(module_name='copy', module_args=self._task.args, task_vars=task_vars, delete_remote_tmp=False)) return result diff --git a/lib/ansible/plugins/action/template.py b/lib/ansible/plugins/action/template.py index 1daca6073e..488b53ba38 100644 --- a/lib/ansible/plugins/action/template.py +++ b/lib/ansible/plugins/action/template.py @@ -57,21 +57,15 @@ class ActionModule(ActionBase): source = self._task.args.get('src', None) dest = self._task.args.get('dest', None) - faf = self._task.first_available_file force = boolean(self._task.args.get('force', True)) state = self._task.args.get('state', None) if state is not None: result['failed'] = True result['msg'] = "'state' cannot be specified on a template" - elif (source is None and faf is not None) or dest is None: + elif source is None or dest is None: result['failed'] = True result['msg'] = "src and dest are required" - elif faf: - source = self._get_first_available_file(faf, task_vars.get('_original_file', None, 'templates')) - if source is None: - result['failed'] = True - result['msg'] = "could not find src in first_available_file list" else: try: source = self._find_needle('templates', source)