From 4e8ed92130528dcecbd590f29597ff449f605656 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Wed, 5 Mar 2014 18:49:54 -0500 Subject: [PATCH] Fixes #6077 decode escaped newline characters in content for the copy module --- lib/ansible/runner/action_plugins/copy.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/runner/action_plugins/copy.py b/lib/ansible/runner/action_plugins/copy.py index 0ee9b6f3ced..79acdaba587 100644 --- a/lib/ansible/runner/action_plugins/copy.py +++ b/lib/ansible/runner/action_plugins/copy.py @@ -54,6 +54,12 @@ class ActionModule(object): raw = utils.boolean(options.get('raw', 'no')) force = utils.boolean(options.get('force', 'yes')) + # content with newlines is going to be escaped to safely load in yaml + # now we need to unescape it so that the newlines are evaluated properly + # when writing the file to disk + if content: + content = content.decode('unicode-escape') + if (source is None and content is None and not 'first_available_file' in inject) or dest is None: result=dict(failed=True, msg="src (or content) and dest are required") return ReturnData(conn=conn, result=result)