mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07:00
[PR #9579/0de39a6f backport][stable-10] use open() as context manager (#9596)
use open() as context manager (#9579)
* use open() as context manager
* add changelog frag
(cherry picked from commit 0de39a6f47
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
98d25a3e4d
commit
e9b58cfc09
13 changed files with 72 additions and 102 deletions
|
@ -308,9 +308,8 @@ class Rhsm(object):
|
|||
else:
|
||||
cfg.set('main', 'enabled', '0')
|
||||
|
||||
fd = open(tmpfile, 'w+')
|
||||
cfg.write(fd)
|
||||
fd.close()
|
||||
with open(tmpfile, 'w+') as fd:
|
||||
cfg.write(fd)
|
||||
self.module.atomic_move(tmpfile, plugin_conf)
|
||||
|
||||
def enable(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue