mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +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
@@ -430,8 +430,9 @@ class JenkinsPlugin(object):
|
||||
md5sum_old = None
|
||||
if os.path.isfile(plugin_file):
|
||||
# Make the checksum of the currently installed plugin
|
||||
md5sum_old = hashlib.md5(
|
||||
open(plugin_file, 'rb').read()).hexdigest()
|
||||
with open(plugin_file, 'rb') as md5_plugin_fh:
|
||||
md5_plugin_content = md5_plugin_fh.read()
|
||||
md5sum_old = hashlib.md5(md5_plugin_content).hexdigest()
|
||||
|
||||
if self.params['version'] in [None, 'latest']:
|
||||
# Take latest version
|
||||
@@ -482,7 +483,9 @@ class JenkinsPlugin(object):
|
||||
plugin_data = self._download_updates()
|
||||
|
||||
try:
|
||||
sha1_old = hashlib.sha1(open(plugin_file, 'rb').read())
|
||||
with open(plugin_file, 'rb') as sha1_plugin_fh:
|
||||
sha1_plugin_content = sha1_plugin_fh.read()
|
||||
sha1_old = hashlib.sha1(sha1_plugin_content)
|
||||
except Exception as e:
|
||||
self.module.fail_json(
|
||||
msg="Cannot calculate SHA1 of the old plugin.",
|
||||
|
||||
Reference in New Issue
Block a user