mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #24831 from DSRCompany/cherrypy_timeout
Cherrypy timeout
This commit is contained in:
commit
650891c923
@ -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(
|
||||
|
@ -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 ----------------------
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user