Merge pull request #43159 from jubrad/bp-43018

Bp 43018
This commit is contained in:
Nicole Thomas 2017-09-05 18:29:15 -04:00 committed by GitHub
commit 015cbc57d9

View file

@ -37,6 +37,7 @@ import salt.utils.dictupdate
import salt.utils.event
import salt.utils.url
import salt.utils.process
import salt.utils.files
import salt.syspaths as syspaths
from salt.utils import immutabletypes
from salt.template import compile_template, compile_template_str
@ -146,6 +147,13 @@ def _gen_tag(low):
return '{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}'.format(low)
def _clean_tag(tag):
'''
Make tag name safe for filenames
'''
return salt.utils.files.safe_filename_leaf(tag)
def _l_tag(name, id_):
low = {'name': 'listen_{0}'.format(name),
'__id__': 'listen_{0}'.format(id_),
@ -1695,7 +1703,7 @@ class State(object):
trb)
}
troot = os.path.join(self.opts['cachedir'], self.jid)
tfile = os.path.join(troot, tag)
tfile = os.path.join(troot, _clean_tag(tag))
if not os.path.isdir(troot):
try:
os.makedirs(troot)
@ -2047,7 +2055,7 @@ class State(object):
proc = running[tag].get('proc')
if proc:
if not proc.is_alive():
ret_cache = os.path.join(self.opts['cachedir'], self.jid, tag)
ret_cache = os.path.join(self.opts['cachedir'], self.jid, _clean_tag(tag))
if not os.path.isfile(ret_cache):
ret = {'result': False,
'comment': 'Parallel process failed to return',