From 8985a1fbd9a22ca89e07f7c4dd75512d3a326d1d Mon Sep 17 00:00:00 2001 From: YAEGASHI Takeshi Date: Mon, 24 Oct 2016 23:30:46 +0900 Subject: [PATCH] blockinfile: Add a newline at EOF when the file is newly created (#3174) Ref: #2687 --- files/blockinfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/blockinfile.py b/files/blockinfile.py index 8ba76181886..30fe77d9244 100755 --- a/files/blockinfile.py +++ b/files/blockinfile.py @@ -285,7 +285,7 @@ def main(): if lines: result = '\n'.join(lines) - if original and original.endswith('\n'): + if original is None or original.endswith('\n'): result += '\n' else: result = ''