From a97872906f231ee6ba96ca648b14141b70e25f18 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 23 Sep 2013 15:29:13 -0500 Subject: [PATCH] Fixed a bug in the delimiter change for the assemble module --- CHANGELOG.md | 1 + library/files/assemble | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 972710a03b6..46ca9b0be16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ New modules: Misc changes: +* Added a `delimiter` field to the assemble module. * Added `ansible_env` to the list of facts returned by the setup module. * Added `state=touch` to the file module, which functions similarly to the command-line version of `touch`. * Added a -vvvv level, which will show SSH client debugging information in the event of a failure. diff --git a/library/files/assemble b/library/files/assemble index a69d9d1e486..83b8a327253 100644 --- a/library/files/assemble +++ b/library/files/assemble @@ -76,14 +76,14 @@ EXAMPLES = ''' # =========================================== # Support method -def assemble_from_fragments(src_path, delimiter=''): +def assemble_from_fragments(src_path, delimiter=None): ''' assemble a file from a directory of fragments ''' tmpfd, temp_path = tempfile.mkstemp() tmp = os.fdopen(tmpfd,'w') delimit_me = False for f in sorted(os.listdir(src_path)): fragment = "%s/%s" % (src_path, f) - if delimit_me: + if delimit_me and delimiter: tmp.write(delimiter) if os.path.isfile(fragment): tmp.write(file(fragment).read()) @@ -107,13 +107,13 @@ def main(): add_file_common_args=True ) - changed = False - pathmd5 = None - destmd5 = None - src = os.path.expanduser(module.params['src']) - dest = os.path.expanduser(module.params['dest']) - backup = module.params['backup'] - delimiter = module.params['delimiter'] + changed = False + pathmd5 = None + destmd5 = None + src = os.path.expanduser(module.params['src']) + dest = os.path.expanduser(module.params['dest']) + backup = module.params['backup'] + delimiter = module.params['delimiter'] if not os.path.exists(src): module.fail_json(msg="Source (%s) does not exist" % src)