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
)
This commit is contained in:
parent
b618339c32
commit
1a4604361f
3 changed files with 10 additions and 2 deletions
4
changelogs/fragments/47133-pamd_use_module_tmpdir.yml
Normal file
4
changelogs/fragments/47133-pamd_use_module_tmpdir.yml
Normal file
|
@ -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…
Reference in a new issue