blockinfile - Remove unused code for Ansible 1.x. (#75040)

pull/75051/head
Matt Clay 4 years ago committed by GitHub
parent 5e65d9834b
commit ce17498ec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- blockinfile - Remove unused code for Ansible 1.x.

@ -265,9 +265,6 @@ def main():
marker0 = re.sub(b(r'{mark}'), b(params['marker_begin']), marker) + b(os.linesep) marker0 = re.sub(b(r'{mark}'), b(params['marker_begin']), marker) + b(os.linesep)
marker1 = re.sub(b(r'{mark}'), b(params['marker_end']), marker) + b(os.linesep) marker1 = re.sub(b(r'{mark}'), b(params['marker_end']), marker) + b(os.linesep)
if present and block: if present and block:
# Escape sequences like '\n' need to be handled in Ansible 1.x
if module.ansible_version.startswith('1.'):
block = re.sub('', block, '')
if not block.endswith(b(os.linesep)): if not block.endswith(b(os.linesep)):
block += b(os.linesep) block += b(os.linesep)
blocklines = [marker0] + block.splitlines(True) + [marker1] blocklines = [marker0] + block.splitlines(True) + [marker1]

Loading…
Cancel
Save