summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jcammarata@ansibleworks.com>2014-03-06 09:44:56 -0600
committerJames Cammarata <jimi@sngx.net>2014-03-10 15:58:43 -0500
commit27d52fd9cc74ac0a8aac18e13d85563557479ea0 (patch)
treee7ff1efdd205e4a251e27f8a6d6ef68672215c88
parent8e7a384fcccc1c249075b90043939e4b89ed86a6 (diff)
downloadansible-27d52fd9cc74ac0a8aac18e13d85563557479ea0.tar.gz
Un-escape newlines in delimiters for assemble module
-rw-r--r--lib/ansible/runner/action_plugins/assemble.py6
-rw-r--r--library/files/assemble2
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/ansible/runner/action_plugins/assemble.py b/lib/ansible/runner/action_plugins/assemble.py
index eb6faf5dfc..c73964cda6 100644
--- a/lib/ansible/runner/action_plugins/assemble.py
+++ b/lib/ansible/runner/action_plugins/assemble.py
@@ -39,7 +39,13 @@ class ActionModule(object):
for f in sorted(os.listdir(src_path)):
fragment = "%s/%s" % (src_path, f)
if delimit_me and delimiter:
+ # en-escape things like new-lines
+ delimiter = delimiter.decode('unicode-escape')
tmp.write(delimiter)
+ # always make sure there's a newline after the
+ # delimiter, so lines don't run together
+ if delimiter[-1] != '\n':
+ tmp.write('\n')
if os.path.isfile(fragment):
tmp.write(file(fragment).read())
delimit_me = True
diff --git a/library/files/assemble b/library/files/assemble
index a8c78256e2..f4a60caf23 100644
--- a/library/files/assemble
+++ b/library/files/assemble
@@ -107,6 +107,8 @@ def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None):
continue
fragment = "%s/%s" % (src_path, f)
if delimit_me and delimiter:
+ # un-escape anything like newlines
+ delimiter = delimiter.decode('unicode-escape')
tmp.write(delimiter)
# always make sure there's a newline after the
# delimiter, so lines don't run together