lineinfile - Use ANSIBLE_REMOTE_TMP for temporary file (#69543)

This commit is contained in:
Sam Doran 2020-05-15 15:52:17 -04:00 committed by GitHub
parent 34db57a47f
commit b8469d5c7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

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

View file

@ -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)