parent
1e6aa9533c
commit
63ea96d5f1
2 changed files with 8 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- assemble - avoid extra newline on Python 3 (https://github.com/ansible/ansible/issues/44739)
|
|
@ -116,7 +116,7 @@ import re
|
|||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import b
|
||||
from ansible.module_utils.six import b, indexbytes
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
|
@ -148,7 +148,11 @@ def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None, igno
|
|||
tmp.write(delimiter)
|
||||
# always make sure there's a newline after the
|
||||
# delimiter, so lines don't run together
|
||||
if delimiter[-1] != b('\n'):
|
||||
|
||||
# byte indexing differs on Python 2 and 3,
|
||||
# use indexbytes for compat
|
||||
# chr(10) == '\n'
|
||||
if indexbytes(delimiter, -1) != 10:
|
||||
tmp.write(b('\n'))
|
||||
|
||||
tmp.write(fragment_content)
|
||||
|
|
Loading…
Reference in a new issue