Add timeout option to get_url #6751

Closed
pzhine opened this Issue Mar 29, 2014 · 6 comments

Comments

Projects
None yet
5 participants
@pzhine

pzhine commented Mar 29, 2014

Issue Type:

“Feature Idea”

Ansible Version:

1.5.3

Environment:

Ubuntu 12.04

Summary:

We should be able to specify a timeout for get_url for downloading larger files (or for hitting longer running endpoints).

Right now, it looks like it's fixed at 10 seconds, the default for the timeout param of fetch_url.

Steps To Reproduce:
Expected Results:

TASK: [warmup cache] **********************************************************
changed: [12.34.12.34]

Actual Results:

TASK: [warmup cache] **********************************************************
fatal: [12.34.12.34] => failed to parse: SUDO-SUCCESS-auisjvazbmvdmhizbletefqldvuexvtd
Traceback (most recent call last):
File "/home/ubuntu/.ansible/tmp/ansible-tmp-1396050193.29-76687999901185/get_url", line 1664, in
main()
File "/home/ubuntu/.ansible/tmp/ansible-tmp-1396050193.29-76687999901185/get_url", line 209, in main
tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force)
File "/home/ubuntu/.ansible/tmp/ansible-tmp-1396050193.29-76687999901185/get_url", line 134, in url_get
rsp, info = fetch_url(module, url, use_proxy=use_proxy, force=force, last_mod_time=last_mod_time)
File "/home/ubuntu/.ansible/tmp/ansible-tmp-1396050193.29-76687999901185/get_url", line 1652, in fetch_url
r = urllib2.urlopen(request, None, timeout)
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 406, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 438, in error
result = self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 890, in http_error_401
url, req, headers)
File "/usr/lib/python2.7/urllib2.py", line 865, in http_error_auth_reqed
response = self.retry_http_basic_auth(host, req, realm)
File "/usr/lib/python2.7/urllib2.py", line 878, in retry_http_basic_auth
return self.parent.open(req, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1180, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib/python2.7/httplib.py", line 1030, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 407, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
line = self.fp.readline()
File "/usr/lib/python2.7/socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
socket.timeout: timed out

@mpdehaan

This comment has been minimized.

Show comment
Hide comment
@mpdehaan

mpdehaan Mar 29, 2014

Contributor

Sounds reasonable. Something you would like to work on, perhaps?

Contributor

mpdehaan commented Mar 29, 2014

Sounds reasonable. Something you would like to work on, perhaps?

@pzhine

This comment has been minimized.

Show comment
Hide comment
@pzhine

pzhine Mar 29, 2014

Yeah, I'll work on a pull request.

pzhine commented Mar 29, 2014

Yeah, I'll work on a pull request.

@geerlingguy

This comment has been minimized.

Show comment
Hide comment
@geerlingguy

geerlingguy Apr 28, 2014

Contributor

👍

Contributor

geerlingguy commented Apr 28, 2014

👍

@evgeny-goldin

This comment has been minimized.

Show comment
Hide comment

+1!

@mpdehaan

This comment has been minimized.

Show comment
Hide comment
@mpdehaan

mpdehaan Sep 29, 2014

Contributor

Hi!

Thanks very much for your interest in Ansible. It sincerely means a lot to us.

On September 26, 2014, due to enormous levels of contribution to the project Ansible decided to reorganize module repos, making it easier
for developers to work on the project and for us to more easily manage new contributions and tickets.

We split modules from the main project off into two repos, http://github.com/ansible/ansible-modules-core and http://github.com/ansible/ansible-modules-extras

If you would still like this ticket attended to, and believe this problem or idea is still present in the latest version of Ansible (1.7.2) or the development branch, we will need your help in having it reopened in one of the two new repos, and instructions are provided below.

We apologize that we are not able to make this transition happen seamlessly, though this is a one-time change and your help is greatly appreciated --
this will greatly improve velocity going forward.

Both sets of modules will ship with Ansible, though they'll receive slightly different ticket handling.

To locate where a module lives between 'core' and 'extras'

Additionally, should you need more help with this, you can ask questions on:

Thank you very much!

Contributor

mpdehaan commented Sep 29, 2014

Hi!

Thanks very much for your interest in Ansible. It sincerely means a lot to us.

On September 26, 2014, due to enormous levels of contribution to the project Ansible decided to reorganize module repos, making it easier
for developers to work on the project and for us to more easily manage new contributions and tickets.

We split modules from the main project off into two repos, http://github.com/ansible/ansible-modules-core and http://github.com/ansible/ansible-modules-extras

If you would still like this ticket attended to, and believe this problem or idea is still present in the latest version of Ansible (1.7.2) or the development branch, we will need your help in having it reopened in one of the two new repos, and instructions are provided below.

We apologize that we are not able to make this transition happen seamlessly, though this is a one-time change and your help is greatly appreciated --
this will greatly improve velocity going forward.

Both sets of modules will ship with Ansible, though they'll receive slightly different ticket handling.

To locate where a module lives between 'core' and 'extras'

Additionally, should you need more help with this, you can ask questions on:

Thank you very much!

@mpdehaan mpdehaan closed this Sep 29, 2014

@geerlingguy geerlingguy referenced this issue in ansible/ansible-modules-core Sep 29, 2014

Closed

Add timeout option to get_url #20

@geerlingguy

This comment has been minimized.

Show comment
Hide comment
@geerlingguy

geerlingguy Sep 29, 2014

Contributor

Sure thing! Moved over to ansible/ansible-modules-core#20.

Contributor

geerlingguy commented Sep 29, 2014

Sure thing! Moved over to ansible/ansible-modules-core#20.

@ansibot ansibot added feature and removed feature_idea labels Mar 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment