Allow configuring HTTP connect timeout

This commit is contained in:
mephi42 2018-02-19 13:25:58 +01:00
parent 0101c7279e
commit 46996178e2
No known key found for this signature in database
GPG Key ID: B5DB73637F07226D
4 changed files with 76 additions and 0 deletions

View File

@ -1044,6 +1044,40 @@ cache events are fired when a minion requests a minion data cache refresh.
minion_data_cache_events: True
.. conf_master:: http_connect_timeout
``http_connect_timeout``
------------------------
.. versionadded:: Fluorine
Default: ``20``
HTTP connection timeout in seconds.
Applied when fetching files using tornado back-end.
Should be greater than overall download time.
.. code-block:: yaml
http_connect_timeout: 20
.. conf_master:: http_request_timeout
``http_request_timeout``
------------------------
.. versionadded:: 2015.8.0
Default: ``3600``
HTTP request timeout in seconds.
Applied when fetching files using tornado back-end.
Should be greater than overall download time.
.. code-block:: yaml
http_request_timeout: 3600
.. _salt-ssh-configuration:
Salt-SSH Configuration

View File

@ -1267,6 +1267,40 @@ talking to the intended master.
syndic_finger: 'ab:30:65:2a:d6:9e:20:4f:d8:b2:f3:a7:d4:65:50:10'
.. conf_minion:: http_connect_timeout
``http_connect_timeout``
------------------------
.. versionadded:: Fluorine
Default: ``20``
HTTP connection timeout in seconds.
Applied when fetching files using tornado back-end.
Should be greater than overall download time.
.. code-block:: yaml
http_connect_timeout: 20
.. conf_minion:: http_request_timeout
``http_request_timeout``
------------------------
.. versionadded:: 2015.8.0
Default: ``3600``
HTTP request timeout in seconds.
Applied when fetching files using tornado back-end.
Should be greater than overall download time.
.. code-block:: yaml
http_request_timeout: 3600
.. conf_minion:: proxy_host
``proxy_host``

View File

@ -1050,6 +1050,10 @@ VALID_OPTS = {
# If set, all minion exec module actions will be rerouted through sudo as this user
'sudo_user': six.string_types,
# HTTP connection timeout in seconds. Applied for tornado http fetch functions like cp.get_url
# should be greater than overall download time
'http_connect_timeout': float,
# HTTP request timeout in seconds. Applied for tornado http fetch functions like cp.get_url
# should be greater than overall download time
'http_request_timeout': float,
@ -1451,6 +1455,7 @@ DEFAULT_MINION_OPTS = {
'cache_sreqs': True,
'cmd_safe': True,
'sudo_user': '',
'http_connect_timeout': 20.0, # tornado default - 20 seconds
'http_request_timeout': 1 * 60 * 60.0, # 1 hour
'http_max_body': 100 * 1024 * 1024 * 1024, # 100GB
'event_match_type': 'startswith',
@ -1785,6 +1790,7 @@ DEFAULT_MASTER_OPTS = {
'rotate_aes_key': True,
'cache_sreqs': True,
'dummy_pub': False,
'http_connect_timeout': 20.0, # tornado default - 20 seconds
'http_request_timeout': 1 * 60 * 60.0, # 1 hour
'http_max_body': 100 * 1024 * 1024 * 1024, # 100GB
'python2_bin': 'python2',

View File

@ -491,6 +491,7 @@ def query(url,
req_kwargs['ca_certs'] = ca_bundle
max_body = opts.get('http_max_body', salt.config.DEFAULT_MINION_OPTS['http_max_body'])
connect_timeout = opts.get('http_connect_timeout', salt.config.DEFAULT_MINION_OPTS['http_connect_timeout'])
timeout = opts.get('http_request_timeout', salt.config.DEFAULT_MINION_OPTS['http_request_timeout'])
client_argspec = None
@ -532,6 +533,7 @@ def query(url,
allow_nonstandard_methods=True,
streaming_callback=streaming_callback,
header_callback=header_callback,
connect_timeout=connect_timeout,
request_timeout=timeout,
proxy_host=proxy_host,
proxy_port=proxy_port,