From 065fcb999ef35437530f869cd934a08520268aba Mon Sep 17 00:00:00 2001 From: Hannes Schaller Date: Thu, 1 Sep 2022 15:22:57 +0200 Subject: [PATCH 1/2] honor timeouts defined in the action --- CHANGES.md | 4 ++++ actions/lib/action.py | 3 ++- pack.yaml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cacebfd..52cce59 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Change Log +## v2.1.0 + +* Timeouts defined in the action are now honored properly + ## v2.0.0 * Drop Python 2.7 support diff --git a/actions/lib/action.py b/actions/lib/action.py index 33ea4a3..e0eac27 100755 --- a/actions/lib/action.py +++ b/actions/lib/action.py @@ -112,13 +112,14 @@ def run(self, **kwargs): # parse parameters operation = self._get_del_arg('operation', kwargs_dict) + timeout = self._get_del_arg('timeout', kwargs_dict) connection = self._resolve_connection(kwargs_dict) self._validate_connection(connection) # connect to the server client = foreman.client.Foreman('https://{}/'.format(connection['server']), auth=(connection['username'], connection['password']), - api_version=2) + api_version=2, timeout=timeout) # Performs a "deep" getattr() lookup so we can pass a string like # 'method1.method2.method3' without having to chain getattr() diff --git a/pack.yaml b/pack.yaml index 7455ef3..a6ef059 100644 --- a/pack.yaml +++ b/pack.yaml @@ -8,7 +8,7 @@ keywords: - red - hat - redhat -version: 2.0.0 +version: 2.1.0 author: Daniel Chamot email: daniel@nullkarma.com python_versions: From a43e5364ddb8db6a66a7eee721f155fa76bc185f Mon Sep 17 00:00:00 2001 From: Hannes Schaller Date: Tue, 31 Jan 2023 15:52:15 +0100 Subject: [PATCH 2/2] update tests --- tests/test_action_lib_baseaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_action_lib_baseaction.py b/tests/test_action_lib_baseaction.py index a729101..ca60404 100644 --- a/tests/test_action_lib_baseaction.py +++ b/tests/test_action_lib_baseaction.py @@ -157,5 +157,5 @@ def test_run(self, mock_foreman): self.assertEqual(result, op_result) mock_foreman.assert_called_with('https://{}/'.format(connection['server']), auth=(connection['username'], connection['password']), - api_version=2) + api_version=2, timeout=None) mock_func.assert_called_with(**op_args)