pamd: add delete=False to NamedTemporaryFile() (#47281)

* add delete=False to NamedTemporaryFile and remove print statement from module

* add changelog fragment

* use module.tmpdir from (#47133) and add changelog fragment for it as well

(cherry picked from commit c67ab296bb)
pull/47468/head
Daniel Shepherd 7 years ago committed by Toshio Kuratomi
parent b618339c32
commit 1a4604361f

@ -0,0 +1,4 @@
---
bugfixes:
- "pamd: use module.tmpdir for NamedTemporaryFile()
(see https://github.com/ansible/ansible/pull/47133 and https://github.com/ansible/ansible/issues/36954)"

@ -0,0 +1,5 @@
---
bugfixes:
- "pamd: add delete=False to NamedTemporaryFile() fixes OSError on module completion, and
removes print statement from module code.
(see https://github.com/ansible/ansible/pull/47281 and https://github.com/ansible/ansible/issues/47080)"

@ -776,9 +776,8 @@ def main():
# First, create a backup if desired.
if module.params['backup']:
backupdest = module.backup_local(fname)
print("BACKUP DEST", backupdest)
try:
temp_file = NamedTemporaryFile(mode='w')
temp_file = NamedTemporaryFile(mode='w', dir=module.tmpdir, delete=False)
with open(temp_file.name, 'w') as fd:
fd.write(str(service))

Loading…
Cancel
Save