From 4be7fa44a743fbcdf792e2bdca3af6c95b540f97 Mon Sep 17 00:00:00 2001 From: Sergiy Markin Date: Thu, 11 May 2023 20:58:18 +0000 Subject: [PATCH] Armada timeout adjustment This PS set read/connection timeout to None for http requests. Change-Id: Ic874485bb82a9c386224f5adc530e366b01ae24e --- armada/api/controller/tiller.py | 1 + armada/tests/unit/utils/test_source.py | 3 ++- armada/utils/source.py | 2 +- armada/utils/validate.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/armada/api/controller/tiller.py b/armada/api/controller/tiller.py index 13da2e3f..a2ee7b03 100644 --- a/armada/api/controller/tiller.py +++ b/armada/api/controller/tiller.py @@ -19,6 +19,7 @@ from oslo_log import log as logging from armada import api from armada.common import policy + CONF = cfg.CONF LOG = logging.getLogger(__name__) diff --git a/armada/tests/unit/utils/test_source.py b/armada/tests/unit/utils/test_source.py index a966c670..2c2c8dc4 100644 --- a/armada/tests/unit/utils/test_source.py +++ b/armada/tests/unit/utils/test_source.py @@ -110,7 +110,8 @@ class GitTestCase(base.ArmadaTestCase): source.download_tarball(url) mock_temp.mkstemp.assert_called_once() - mock_requests.get.assert_called_once_with(url, timeout=5, verify=False) + mock_requests.get.assert_called_once_with( + url, timeout=None, verify=False) mock_open.assert_called_once_with('/tmp/armada', 'wb') mock_open().write.assert_called_once_with( mock_requests.get(url).content) diff --git a/armada/utils/source.py b/armada/utils/source.py index 1a471c1e..43be2a7c 100644 --- a/armada/utils/source.py +++ b/armada/utils/source.py @@ -135,7 +135,7 @@ def download_tarball(tarball_url, verify=False, proxy_server=None): } tarball_filename = tempfile.mkstemp(prefix='armada')[1] response = requests.get( - tarball_url, timeout=5, verify=verify, **kwargs) + tarball_url, timeout=None, verify=verify, **kwargs) with open(tarball_filename, 'wb') as f: f.write(response.content) diff --git a/armada/utils/validate.py b/armada/utils/validate.py index b4c46a49..a0a4f4a1 100644 --- a/armada/utils/validate.py +++ b/armada/utils/validate.py @@ -177,6 +177,6 @@ def validate_armada_documents(documents): def validate_manifest_url(value): try: - return (requests.get(value, timeout=5).status_code == 200) + return (requests.get(value, timeout=None).status_code == 200) except requests.exceptions.RequestException: return False