diff --git a/fuel_agent/tests/test_utils.py b/fuel_agent/tests/test_utils.py index 5a96a00..42f9925 100644 --- a/fuel_agent/tests/test_utils.py +++ b/fuel_agent/tests/test_utils.py @@ -18,6 +18,7 @@ import testtools import mock from oslo.config import cfg import requests +import socket import stevedore import urllib3 @@ -140,6 +141,7 @@ class ExecuteTestCase(testtools.TestCase): requests.exceptions.ConnectionError(), requests.exceptions.Timeout(), requests.exceptions.TooManyRedirects(), + socket.timeout(), mock_ok] req_obj = utils.init_http_request('fake_url') self.assertEqual(mock_ok, req_obj) diff --git a/fuel_agent/utils/utils.py b/fuel_agent/utils/utils.py index 5a1f253..aa0a6ad 100644 --- a/fuel_agent/utils/utils.py +++ b/fuel_agent/utils/utils.py @@ -18,6 +18,7 @@ import math import os import re import shlex +import socket import subprocess import time @@ -203,7 +204,8 @@ def init_http_request(url, byte_range=0): url, stream=True, timeout=CONF.http_request_timeout, headers={'Range': 'bytes=%s-' % byte_range}) - except (urllib3.exceptions.DecodeError, + except (socket.timeout, + urllib3.exceptions.DecodeError, urllib3.exceptions.ProxyError, requests.exceptions.ConnectionError, requests.exceptions.Timeout,