Commit b90d469e authored by Xavier Thompson's avatar Xavier Thompson

utils: Fix untimeouted request in _ReadAsJson

This could cause slapos request to hang forever while fetching the
json schema of an SR, and in particular it could cause buildout to
hang forever in instance processing when requesting a sub-instance.

See merge request nexedi/slapos.core!575
parent 78eedc42
...@@ -424,7 +424,7 @@ def _readAsJson(url): ...@@ -424,7 +424,7 @@ def _readAsJson(url):
return None return None
if url.startswith('http://') or url.startswith('https://'): if url.startswith('http://') or url.startswith('https://'):
try: try:
r = requests.get(url) r = requests.get(url, timeout=60) # we need a timeout !
r.raise_for_status() r.raise_for_status()
return r.json() return r.json()
except (requests.exceptions.RequestException, ValueError): except (requests.exceptions.RequestException, ValueError):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment