mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Switch from base64 encoding to sha1 digest for unique cache filename
This commit is contained in:
parent
0e26dc6f70
commit
7ddfd720ed
@ -1735,7 +1735,7 @@ class State(object):
|
||||
troot = os.path.join(self.opts['cachedir'], self.jid)
|
||||
tfile = os.path.join(
|
||||
troot,
|
||||
salt.utils.hashutils.base64_b64encode(tag)[:32])
|
||||
salt.utils.hashutils.sha1_digest(tag))
|
||||
if not os.path.isdir(troot):
|
||||
try:
|
||||
os.makedirs(troot)
|
||||
@ -2097,7 +2097,7 @@ class State(object):
|
||||
ret_cache = os.path.join(
|
||||
self.opts['cachedir'],
|
||||
self.jid,
|
||||
salt.utils.hashutils.base64_b64encode(tag)[:32])
|
||||
salt.utils.hashutils.sha1_digest(tag))
|
||||
if not os.path.isfile(ret_cache):
|
||||
ret = {'result': False,
|
||||
'comment': 'Parallel process failed to return',
|
||||
|
@ -82,6 +82,16 @@ def md5_digest(instr):
|
||||
return hashlib.md5(instr).hexdigest()
|
||||
|
||||
|
||||
def sha1_digest(instr):
|
||||
'''
|
||||
Generate an sha1 hash of a given string.
|
||||
'''
|
||||
if six.PY3:
|
||||
b = salt.utils.to_bytes(instr)
|
||||
return hashlib.sha1(b).hexdigest()
|
||||
return hashlib.sha1(instr).hexdigest()
|
||||
|
||||
|
||||
def sha256_digest(instr):
|
||||
'''
|
||||
Generate an sha256 hash of a given string.
|
||||
|
Loading…
Reference in New Issue
Block a user