[stable-2.9] lineinfile - Use ANSIBLE_REMOTE_TMP for temporary file (#69543) (#69549)

(cherry picked from commit b8469d5c7a)

Co-authored-by: Sam Doran <sdoran@redhat.com>
pull/69999/head
Sam Doran 5 years ago committed by GitHub
parent f39b106f83
commit df3540073c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- lineinfile - use ``module.tmpdir`` to allow configuration of the remote temp directory (https://github.com/ansible/ansible/issues/68218)

@ -213,7 +213,7 @@ from ansible.module_utils._text import to_bytes, to_native
def write_changes(module, b_lines, dest): def write_changes(module, b_lines, dest):
tmpfd, tmpfile = tempfile.mkstemp() tmpfd, tmpfile = tempfile.mkstemp(dir=module.tmpdir)
with os.fdopen(tmpfd, 'wb') as f: with os.fdopen(tmpfd, 'wb') as f:
f.writelines(b_lines) f.writelines(b_lines)

Loading…
Cancel
Save