diff options
author | Brian Coca <bcoca@ansible.com> | 2016-06-01 09:16:30 -0400 |
---|---|---|
committer | Brian Coca <bcoca@ansible.com> | 2016-06-01 09:16:30 -0400 |
commit | 702863b403d98b72198d0d3f31784d469008b07e (patch) | |
tree | d82653687a09c77af3a6c62783791bec157837c2 | |
parent | a596ba31061f8b7562d050e0acf9367bb1b2c7d2 (diff) | |
download | ansible-revert-10399-assemble-with-prefix-and-suffix.tar.gz |
Revert "Add prefixing and suffixing fuctionality to assemble module"revert-10399-assemble-with-prefix-and-suffix
-rw-r--r-- | lib/ansible/plugins/action/assemble.py | 18 | ||||
-rw-r--r-- | test/integration/roles/test_assemble/tasks/main.yml | 10 |
2 files changed, 2 insertions, 26 deletions
diff --git a/lib/ansible/plugins/action/assemble.py b/lib/ansible/plugins/action/assemble.py index 69f32656e3..5cdfc7cbfb 100644 --- a/lib/ansible/plugins/action/assemble.py +++ b/lib/ansible/plugins/action/assemble.py @@ -32,7 +32,7 @@ class ActionModule(ActionBase): TRANSFERS_FILES = True - def _assemble_from_fragments(self, src_path, delimiter=None, compiled_regexp=None, ignore_hidden=False, header=None, footer=None): + def _assemble_from_fragments(self, src_path, delimiter=None, compiled_regexp=None, ignore_hidden=False): ''' assemble a file from a directory of fragments ''' tmpfd, temp_path = tempfile.mkstemp() @@ -40,11 +40,6 @@ class ActionModule(ActionBase): delimit_me = False add_newline = False - if header is not None: - if not header.endswith('\n'): - header += '\n' - tmp.write(header) - for f in sorted(os.listdir(src_path)): if compiled_regexp and not compiled_regexp.search(f): continue @@ -75,13 +70,6 @@ class ActionModule(ActionBase): else: add_newline = True - if footer is not None: - if add_newline: # last fragment did not end with \n - footer = '\n' + footer - if not footer.endswith('\n'): - footer += '\n' - tmp.write(footer) - tmp.close() return temp_path @@ -99,8 +87,6 @@ class ActionModule(ActionBase): src = self._task.args.get('src', None) dest = self._task.args.get('dest', None) delimiter = self._task.args.get('delimiter', None) - header = self._task.args.get('header', None) - footer = self._task.args.get('footer', None) remote_src = self._task.args.get('remote_src', 'yes') regexp = self._task.args.get('regexp', None) follow = self._task.args.get('follow', False) @@ -135,7 +121,7 @@ class ActionModule(ActionBase): return result # Does all work assembling the file - path = self._assemble_from_fragments(src, delimiter, _re, ignore_hidden, header, footer) + path = self._assemble_from_fragments(src, delimiter, _re, ignore_hidden) path_checksum = checksum_s(path) dest = self._remote_expand_user(dest) diff --git a/test/integration/roles/test_assemble/tasks/main.yml b/test/integration/roles/test_assemble/tasks/main.yml index 9699b10508..d0c1f15e56 100644 --- a/test/integration/roles/test_assemble/tasks/main.yml +++ b/test/integration/roles/test_assemble/tasks/main.yml @@ -91,13 +91,3 @@ - "result.state == 'file'" - "result.checksum == '505359f48c65b3904127cf62b912991d4da7ed6d'" -- name: test assemble with a header and a footer - assemble: src="{{output_dir}}/src" dest="{{output_dir}}/assembled6" header="prefix" footer="suffix" - register: result - -- name: assert the fragments were assembled with a header and a footer - assert: - that: - - "result.state == 'file'" - - "result.checksum == 'c5cca6452da7b193427ea17583188f7a17df3b60'" - |