From 0cabd133ba846e59371af7f895a88c1c506b3930 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 25 Mar 2016 12:09:30 -0700 Subject: [PATCH] have to always run dwim() on the path to get the full absolute path. Fixes #14944 --- lib/ansible/plugins/action/synchronize.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/ansible/plugins/action/synchronize.py b/lib/ansible/plugins/action/synchronize.py index 02771e3fcc..115791759a 100644 --- a/lib/ansible/plugins/action/synchronize.py +++ b/lib/ansible/plugins/action/synchronize.py @@ -30,18 +30,17 @@ from ansible import constants as C class ActionModule(ActionBase): def _get_absolute_path(self, path): + original_path = path + if self._task._role is not None: - original_path = path + path = self._loader.path_dwim_relative(self._task._role._role_path, 'files', path) + else: + path = self._loader.path_dwim_relative(self._loader.get_basedir(), 'files', path) - if self._task._role is not None: - path = self._loader.path_dwim_relative(self._task._role._role_path, 'files', path) - else: - path = self._loader.path_dwim_relative(self._loader.get_basedir(), 'files', path) - - if original_path and original_path[-1] == '/' and path[-1] != '/': - # make sure the dwim'd path ends in a trailing "/" - # if the original path did - path += '/' + if original_path and original_path[-1] == '/' and path[-1] != '/': + # make sure the dwim'd path ends in a trailing "/" + # if the original path did + path += '/' return path