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

This commit is contained in:
Matt Clay 2021-06-17 07:32:42 -07:00 committed by GitHub
parent 5e65d9834b
commit ce17498ec5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

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

View file

@ -265,9 +265,6 @@ def main():
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)
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)):
block += b(os.linesep)
blocklines = [marker0] + block.splitlines(True) + [marker1]