Skip to content

Commit

Permalink
Merge pull request #46102 from mephi42/develop
Browse files Browse the repository at this point in the history
Allow configuring HTTP connect timeout
  • Loading branch information
Nicole Thomas committed Feb 26, 2018
2 parents 87ba05c + 4699617 commit f9408ce
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
34 changes: 34 additions & 0 deletions doc/ref/configuration/master.rst
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions doc/ref/configuration/minion.rst
Expand Up @@ -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``
Expand Down
6 changes: 6 additions & 0 deletions salt/config/__init__.py
Expand Up @@ -1050,6 +1050,10 @@ def _gather_buffer_space():
# 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,
Expand Down Expand Up @@ -1451,6 +1455,7 @@ def _gather_buffer_space():
'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',
Expand Down Expand Up @@ -1785,6 +1790,7 @@ def _gather_buffer_space():
'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',
Expand Down
2 changes: 2 additions & 0 deletions salt/utils/http.py
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f9408ce

Please sign in to comment.