diff options
author | James Tanner <tanner.jc@gmail.com> | 2014-03-05 18:49:54 -0500 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2014-03-10 15:55:35 -0500 |
commit | 9ba1245a84370957b0cc1c350725a2e726b3d03a (patch) | |
tree | eb7119fe003af0cc92e05d6c81d295816e8808e5 | |
parent | 76037168b10f7e9ac09a084cbc16a19fd1a1c8c1 (diff) | |
download | ansible-9ba1245a84370957b0cc1c350725a2e726b3d03a.tar.gz |
Fixes #6077 decode escaped newline characters in content for the copy module
-rw-r--r-- | lib/ansible/runner/action_plugins/copy.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ansible/runner/action_plugins/copy.py b/lib/ansible/runner/action_plugins/copy.py index 0ee9b6f3ce..79acdaba58 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) |