mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-20 01:11:26 -07:00
use open() as context manager (#9579)
* use open() as context manager * add changelog frag
This commit is contained in:
parent
c5cc949492
commit
0de39a6f47
13 changed files with 72 additions and 102 deletions
|
@ -460,15 +460,11 @@ def match_depends(module):
|
|||
|
||||
if depends_new:
|
||||
try:
|
||||
try:
|
||||
fl = open(sorcery_depends, 'a')
|
||||
|
||||
with open(sorcery_depends, 'a') as fl:
|
||||
for k in depends_new:
|
||||
fl.write("%s:%s:%s:optional::\n" % (spell, k, depends[k]))
|
||||
except IOError:
|
||||
module.fail_json(msg="I/O error on the depends file")
|
||||
finally:
|
||||
fl.close()
|
||||
except IOError:
|
||||
module.fail_json(msg="I/O error on the depends file")
|
||||
|
||||
depends_ok = False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue