From 48f293306070f44ae1a57ab1da90dae45da4818d Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Tue, 1 Aug 2023 15:59:34 -0400 Subject: [PATCH] Fix pylint "W" missing-timeout warnings After updating pylint, it started emitting additional "W" warnings in some cases. Fix the missing-timeout ones by adding a timeout=60 value to the calls done by the metadata agent code. Trivialfix Change-Id: Ica5c2a2d3941813b3518b83738ada96bdf7c3760 --- .pylintrc | 1 - neutron/agent/metadata/agent.py | 3 ++- neutron/agent/ovn/metadata/server.py | 3 ++- neutron/tests/unit/agent/metadata/test_agent.py | 3 ++- neutron/tests/unit/agent/ovn/metadata/test_server.py | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.pylintrc b/.pylintrc index 34b883eb6f7..94eee507498 100644 --- a/.pylintrc +++ b/.pylintrc @@ -60,7 +60,6 @@ disable= arguments-renamed, broad-exception-raised, unspecified-encoding, - missing-timeout, redundant-u-string-prefix, unused-private-member, # "C" Coding convention violations diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index f2b65071941..f0c030f76db 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -256,7 +256,8 @@ class MetadataProxyHandler(object): headers=headers, data=req.body, cert=client_cert, - verify=verify_cert) + verify=verify_cert, + timeout=60) if resp.status_code == 200: req.response.content_type = resp.headers['content-type'] diff --git a/neutron/agent/ovn/metadata/server.py b/neutron/agent/ovn/metadata/server.py index 3431735dff9..75ee4c1e17a 100644 --- a/neutron/agent/ovn/metadata/server.py +++ b/neutron/agent/ovn/metadata/server.py @@ -153,7 +153,8 @@ class MetadataProxyHandler(object): headers=headers, data=req.body, cert=client_cert, - verify=verify_cert) + verify=verify_cert, + timeout=60) if resp.status_code == 200: req.response.content_type = resp.headers['content-type'] diff --git a/neutron/tests/unit/agent/metadata/test_agent.py b/neutron/tests/unit/agent/metadata/test_agent.py index 16df56491da..cc8ff95d5bc 100644 --- a/neutron/tests/unit/agent/metadata/test_agent.py +++ b/neutron/tests/unit/agent/metadata/test_agent.py @@ -434,7 +434,8 @@ class _TestMetadataProxyHandlerCacheMixin(object): data=body, cert=(self.fake_conf.nova_client_cert, self.fake_conf.nova_client_priv_key), - verify=False) + verify=False, + timeout=60) return retval diff --git a/neutron/tests/unit/agent/ovn/metadata/test_server.py b/neutron/tests/unit/agent/ovn/metadata/test_server.py index e4f30ae5600..3f2b2cea5a0 100644 --- a/neutron/tests/unit/agent/ovn/metadata/test_server.py +++ b/neutron/tests/unit/agent/ovn/metadata/test_server.py @@ -167,7 +167,8 @@ class TestMetadataProxyHandler(base.BaseTestCase): data=body, cert=(self.fake_conf.nova_client_cert, self.fake_conf.nova_client_priv_key), - verify=False) + verify=False, + timeout=60) return retval