diff --git a/ironic/drivers/modules/agent_client.py b/ironic/drivers/modules/agent_client.py index cd5e04471b..e03153833e 100644 --- a/ironic/drivers/modules/agent_client.py +++ b/ironic/drivers/modules/agent_client.py @@ -14,6 +14,7 @@ from http import client as http_client import os +import ssl from ironic_lib import metrics_utils from oslo_log import log @@ -203,7 +204,7 @@ class AgentClient(object): url, params=request_params, data=body, verify=self._get_verify(node), timeout=CONF.agent.command_timeout) - except (requests.ConnectionError, requests.Timeout) as e: + except (requests.ConnectionError, requests.Timeout, ssl.SSLError) as e: result = self._handle_timeout_on_command_execution(node, method, params, e) response = None diff --git a/ironic/tests/unit/drivers/modules/test_agent_client.py b/ironic/tests/unit/drivers/modules/test_agent_client.py index 9396639193..8bad2b96b9 100644 --- a/ironic/tests/unit/drivers/modules/test_agent_client.py +++ b/ironic/tests/unit/drivers/modules/test_agent_client.py @@ -14,6 +14,7 @@ from http import client as http_client import json +import ssl from unittest import mock import requests @@ -757,10 +758,11 @@ class TestAgentClientAttempts(base.TestCase): method = 'standby.run_image' image_info = {'image_id': 'test_image'} params = {'image_info': image_info} - self.client.session.post.side_effect = [requests.Timeout(error), - requests.Timeout(error), - requests.Timeout(error), - requests.Timeout(error)] + self.client.session.post.side_effect = [ + requests.Timeout(error), + ssl.SSLError('timed out'), + requests.ConnectionError(error), + requests.Timeout(error)] self.client._get_command_url(self.node) self.client._get_command_body(method, params) @@ -781,7 +783,7 @@ class TestAgentClientAttempts(base.TestCase): image_info = {'image_id': 'test_image'} params = {'image_info': image_info} self.client.session.post.side_effect = [requests.Timeout(error), - requests.Timeout(error), + ssl.SSLError('timed out'), MockResponse(response_data)] response = self.client._command(self.node, method, params) diff --git a/releasenotes/notes/sslerror-287edf7f8b3c5f1c.yaml b/releasenotes/notes/sslerror-287edf7f8b3c5f1c.yaml new file mode 100644 index 0000000000..9eac955bfe --- /dev/null +++ b/releasenotes/notes/sslerror-287edf7f8b3c5f1c.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Retries ``ssl.SSLError`` when connecting to the agent.