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

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

* add changelog fragment
pull/35370/head
Daniel Shepherd 6 years ago committed by Sam Doran
parent c5a9b6acb7
commit c67ab296bb

@ -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. # First, create a backup if desired.
if module.params['backup']: if module.params['backup']:
backupdest = module.backup_local(fname) backupdest = module.backup_local(fname)
print("BACKUP DEST", backupdest)
try: try:
temp_file = NamedTemporaryFile(mode='w', dir=module.tmpdir) temp_file = NamedTemporaryFile(mode='w', dir=module.tmpdir, delete=False)
with open(temp_file.name, 'w') as fd: with open(temp_file.name, 'w') as fd:
fd.write(str(service)) fd.write(str(service))

Loading…
Cancel
Save