mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-31 13:29:08 -07:00
Close all open filehandle (#50544)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
94a1d86d70
commit
db8702cdb8
21 changed files with 81 additions and 47 deletions
|
@ -52,7 +52,8 @@ class ActionModule(ActionBase):
|
|||
if not os.path.isfile(fragment) or (ignore_hidden and os.path.basename(fragment).startswith('.')):
|
||||
continue
|
||||
|
||||
fragment_content = open(self._loader.get_real_file(fragment, decrypt=decrypt), 'rb').read()
|
||||
with open(self._loader.get_real_file(fragment, decrypt=decrypt), 'rb') as fragment_fh:
|
||||
fragment_content = fragment_fh.read()
|
||||
|
||||
# always put a newline between fragments if the previous fragment didn't end with a newline.
|
||||
if add_newline:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue