Patch ansible copy.py to write new line at end of file

if 'content' passed without newline.

suggested and OK landry@
This commit is contained in:
rpe 2014-09-10 20:21:43 +00:00
parent ecdec2b76d
commit 411b5e69c5
2 changed files with 19 additions and 1 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.31 2014/08/24 08:46:42 rpe Exp $
# $OpenBSD: Makefile,v 1.32 2014/09/10 20:21:43 rpe Exp $
COMMENT = ssh based config management framework
MODPY_EGG_VERSION = 1.7.1
DISTNAME = ansible-${MODPY_EGG_VERSION}
REVISION = 0
CATEGORIES = sysutils

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-lib_ansible_runner_action_plugins_copy_py,v 1.1 2014/09/10 20:21:43 rpe Exp $
https://github.com/adamchainz/ansible/commit/842a1b976d650b2c3117a6e0ed1329e5d0d62873
'copy' write new line at end of file if 'content' passed without newline
--- lib/ansible/runner/action_plugins/copy.py.orig Wed Sep 10 21:24:52 2014
+++ lib/ansible/runner/action_plugins/copy.py Wed Sep 10 21:25:00 2014
@@ -315,6 +315,8 @@ class ActionModule(object):
f = os.fdopen(fd, 'w')
try:
f.write(content)
+ if not content.endswith('\n'):
+ f.write('\n')
except Exception, err:
os.remove(content_tempfile)
raise Exception(err)