1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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

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

* add changelog fragment
This commit is contained in:
Daniel Shepherd 2018-10-19 10:46:47 -04:00 committed by Sam Doran
parent c5a9b6acb7
commit c67ab296bb
2 changed files with 6 additions and 2 deletions

View file

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

View file

@ -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', dir=module.tmpdir)
temp_file = NamedTemporaryFile(mode='w', dir=module.tmpdir, delete=False)
with open(temp_file.name, 'w') as fd:
fd.write(str(service))