Merge pull request #24831 from DSRCompany/cherrypy_timeout

Cherrypy timeout
This commit is contained in:
Thomas S Hatch 2015-06-22 11:27:13 -04:00
commit 650891c923
4 changed files with 23 additions and 12 deletions

View File

@ -151,7 +151,7 @@ class SyncClientMixin(object):
ret_tag = salt.utils.event.tagify('ret', base=job['tag'])
if timeout is None:
timeout = 300
timeout = self.opts.get('rest_timeout', 300)
ret = event.get_event(tag=ret_tag, full=True, wait=timeout)
if ret is None:
raise salt.exceptions.SaltClientTimeout(

View File

@ -676,6 +676,9 @@ VALID_OPTS = {
# Used strictly for performance testing in RAET.
'dummy_publisher': bool,
# Used by salt-api for master requests timeout
'rest_timeout': int,
}
# default configurations
@ -1065,6 +1068,7 @@ DEFAULT_API_OPTS = {
# ----- Salt master settings overridden by Salt-API --------------------->
'pidfile': '/var/run/salt-api.pid',
'logfile': '/var/log/salt/api',
'rest_timeout': 300,
# <---- Salt master settings overridden by Salt-API ----------------------
}

View File

@ -988,7 +988,7 @@ class Jobs(LowDataAdapter):
'tools.salt_auth.on': True,
})
def GET(self, jid=None):
def GET(self, jid=None, timeout=''):
'''
A convenience URL for getting lists of previously run jobs or getting
the return from a single job
@ -1069,18 +1069,25 @@ class Jobs(LowDataAdapter):
- 2
- 6.9141387939453125e-06
'''
lowstate = [{
'client': 'runner',
'fun': 'jobs.lookup_jid' if jid else 'jobs.list_jobs',
'jid': jid,
}]
timeout = int(timeout) if timeout.isdigit() else None
if jid:
lowstate.append({
lowstate = [{
'client': 'runner',
'fun': 'jobs.lookup_jid',
'args': (jid,),
'timeout': timeout,
}, {
'client': 'runner',
'fun': 'jobs.list_job',
'jid': jid,
})
'args': (jid,),
'timeout': timeout,
}]
else:
lowstate = [{
'client': 'runner',
'fun': 'jobs.list_jobs',
'timeout': timeout,
}]
cherrypy.request.lowstate = lowstate
job_ret_info = list(self.exec_lowstate(

View File

@ -101,7 +101,7 @@ class RunnerClient(mixins.SyncClientMixin, mixins.AsyncClientMixin, object):
})
'''
reformatted_low = self._reformat_low(low)
return mixins.SyncClientMixin.cmd_sync(self, reformatted_low)
return mixins.SyncClientMixin.cmd_sync(self, reformatted_low, timeout)
class Runner(RunnerClient):