mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Close all open filehandle (#50544)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
committed by
Brian Coca
parent
94a1d86d70
commit
db8702cdb8
@@ -79,7 +79,9 @@ def main():
|
||||
if not os.access(source, os.R_OK):
|
||||
module.fail_json(msg="file is not readable: %s" % source)
|
||||
|
||||
data = base64.b64encode(open(source, 'rb').read())
|
||||
with open(source, 'rb') as source_fh:
|
||||
source_content = source_fh.read()
|
||||
data = base64.b64encode(source_content)
|
||||
|
||||
module.exit_json(content=data, source=source, encoding='base64')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user