From 7782923ea2efc81aac9ae5f249cfd9bd327e7d80 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 9 Jan 2013 14:52:52 +0100 Subject: [PATCH] Revert #1818 but avoid double-dwim, fixing relative fileglob --- lib/ansible/runner/action_plugins/copy.py | 6 +++--- lib/ansible/utils/__init__.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ansible/runner/action_plugins/copy.py b/lib/ansible/runner/action_plugins/copy.py index 437781c371..3eb9c4ed91 100644 --- a/lib/ansible/runner/action_plugins/copy.py +++ b/lib/ansible/runner/action_plugins/copy.py @@ -56,9 +56,9 @@ class ActionModule(object): if not found: results=dict(failed=True, msg="could not find src in first_available_file list") return ReturnData(conn=conn, result=results) - - source = utils.template(self.runner.basedir, source, inject) - source = utils.path_dwim(self.runner.basedir, source) + else: + source = utils.template(self.runner.basedir, source, inject) + source = utils.path_dwim(self.runner.basedir, source) local_md5 = utils.md5(source) if local_md5 is None: diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 27b437c76e..a019e6d739 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -170,7 +170,6 @@ def prepare_writeable_dir(tree): def path_dwim(basedir, given): ''' make relative paths work like folks expect. - if a relative path is provided, convert it to an absolute path. ''' if given.startswith("/"): @@ -178,7 +177,7 @@ def path_dwim(basedir, given): elif given.startswith("~/"): return os.path.expanduser(given) else: - return os.path.abspath(os.path.join(basedir, given)) + return os.path.join(basedir, given) def json_loads(data): ''' parse a JSON string and return a data structure '''