mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Don't use hashlib.md5
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
3f3154ed41
commit
3ed6e05262
3 changed files with 4 additions and 4 deletions
|
@ -89,12 +89,12 @@ class CPModuleTest(ModuleCase):
|
|||
"""
|
||||
src = os.path.join(RUNTIME_VARS.FILES, "file", "base", "file.big")
|
||||
with salt.utils.files.fopen(src, "rb") as fp_:
|
||||
hash_str = hashlib.md5(fp_.read()).hexdigest()
|
||||
hash_str = hashlib.sha256(fp_.read()).hexdigest()
|
||||
|
||||
self.run_function("cp.get_file", ["salt://file.big", tgt], gzip=5)
|
||||
with salt.utils.files.fopen(tgt, "rb") as scene:
|
||||
data = scene.read()
|
||||
self.assertEqual(hash_str, hashlib.md5(data).hexdigest())
|
||||
self.assertEqual(hash_str, hashlib.sha256(data).hexdigest())
|
||||
data = salt.utils.stringutils.to_unicode(data)
|
||||
self.assertIn("KNIGHT: They're nervous, sire.", data)
|
||||
self.assertNotIn("bacon", data)
|
||||
|
|
|
@ -41,7 +41,7 @@ class TestRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
) as reqfp:
|
||||
return_data = reqfp.read()
|
||||
# We're using this checksum as the etag to show file changes
|
||||
checksum = hashlib.md5(return_data).hexdigest()
|
||||
checksum = hashlib.sha256(return_data).hexdigest()
|
||||
if none_match == checksum:
|
||||
# Status code 304 Not Modified is returned if the file is unchanged
|
||||
status_code = 304
|
||||
|
|
|
@ -41,7 +41,7 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
) as reqfp:
|
||||
return_text = reqfp.read().encode("utf-8")
|
||||
# We're using this checksum as the etag to show file changes
|
||||
checksum = hashlib.md5(return_text).hexdigest()
|
||||
checksum = hashlib.sha256(return_text).hexdigest()
|
||||
if none_match == checksum:
|
||||
# Status code 304 Not Modified is returned if the file is unchanged
|
||||
status_code = 304
|
||||
|
|
Loading…
Add table
Reference in a new issue