From 896f6dcd34e3016e7de0ea69258cfa308ff4c373 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Kliemeck Date: Fri, 20 May 2016 10:25:10 +0200 Subject: [PATCH] blockinfile will always add newline at EOF (#2261) --- files/blockinfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/blockinfile.py b/files/blockinfile.py index 37d89ca2c88..81834dfd2da 100644 --- a/files/blockinfile.py +++ b/files/blockinfile.py @@ -280,7 +280,9 @@ def main(): lines[n0:n0] = blocklines if lines: - result = '\n'.join(lines)+'\n' + result = '\n'.join(lines) + if original.endswith('\n'): + result += '\n' else: result = '' if original == result: