From aaaf37ae413c730b93cb7c484f335cbde94bb7fa Mon Sep 17 00:00:00 2001 From: dougluce Date: Tue, 24 May 2016 22:54:07 -0700 Subject: [PATCH] Don't bomb if original didn't exist (#2295) If we don't have an existing file, original ends up as None. Bug introduced in 70fa125 --- lib/ansible/modules/extras/files/blockinfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 lib/ansible/modules/extras/files/blockinfile.py diff --git a/lib/ansible/modules/extras/files/blockinfile.py b/lib/ansible/modules/extras/files/blockinfile.py old mode 100644 new mode 100755 index 81834dfd2da..da67e2d4b37 --- a/lib/ansible/modules/extras/files/blockinfile.py +++ b/lib/ansible/modules/extras/files/blockinfile.py @@ -281,7 +281,7 @@ def main(): if lines: result = '\n'.join(lines) - if original.endswith('\n'): + if original and original.endswith('\n'): result += '\n' else: result = ''