From 2f39d37a97d5ebfc8a71e8c6c599d99156283de3 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 23 Sep 2013 17:12:24 -0500 Subject: [PATCH] Expand destination path in the fetch action Fixes #4215 --- lib/ansible/runner/action_plugins/fetch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/fetch.py b/lib/ansible/runner/action_plugins/fetch.py index 65b0aebae3..28e06f8cfc 100644 --- a/lib/ansible/runner/action_plugins/fetch.py +++ b/lib/ansible/runner/action_plugins/fetch.py @@ -56,6 +56,8 @@ class ActionModule(object): results = dict(failed=True, msg="src and dest are required") return ReturnData(conn=conn, result=results) + source = os.path.expanduser(source) + if flat: if dest.endswith("/"): # if the path ends with "/", we'll use the source filename as the @@ -68,7 +70,8 @@ class ActionModule(object): else: # files are saved in dest dir, with a subdir for each host, then the filename dest = "%s/%s/%s" % (utils.path_dwim(self.runner.basedir, dest), conn.host, source) - dest = dest.replace("//","/") + + dest = os.path.expanduser(dest.replace("//","/")) # calculate md5 sum for the remote file remote_md5 = self.runner._remote_md5(conn, tmp, source)