From ce17498ec5e7da9c25ebd73b04da8842e7ec894f Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 17 Jun 2021 07:32:42 -0700 Subject: [PATCH] blockinfile - Remove unused code for Ansible 1.x. (#75040) --- changelogs/fragments/blockinfile-unused-code.yml | 2 ++ lib/ansible/modules/blockinfile.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/blockinfile-unused-code.yml diff --git a/changelogs/fragments/blockinfile-unused-code.yml b/changelogs/fragments/blockinfile-unused-code.yml new file mode 100644 index 00000000000..37c0ee65038 --- /dev/null +++ b/changelogs/fragments/blockinfile-unused-code.yml @@ -0,0 +1,2 @@ +minor_changes: + - blockinfile - Remove unused code for Ansible 1.x. diff --git a/lib/ansible/modules/blockinfile.py b/lib/ansible/modules/blockinfile.py index fde44b5d600..668c67a3c40 100644 --- a/lib/ansible/modules/blockinfile.py +++ b/lib/ansible/modules/blockinfile.py @@ -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]