From 1362a34f077455e52b4e85f7b7c1bb5315d32010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lipovsk=C3=BD?= Date: Wed, 20 Sep 2023 16:44:17 +0200 Subject: [PATCH] Fixing IIB KeyError when updating request state [CLOUDDST-20361] --- iib/workers/api_utils.py | 2 +- tests/test_workers/test_api_utils.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/iib/workers/api_utils.py b/iib/workers/api_utils.py index 34532e17..ebba0c17 100644 --- a/iib/workers/api_utils.py +++ b/iib/workers/api_utils.py @@ -169,7 +169,7 @@ def update_request( rv.text, ) if exc_msg: - _exc_msg = exc_msg.format(**payload) + _exc_msg = exc_msg.format(**payload, request_id=request_id) else: _exc_msg = f'The worker failed to update the request {request_id}' raise IIBError(_exc_msg) diff --git a/tests/test_workers/test_api_utils.py b/tests/test_workers/test_api_utils.py index 9c5fd701..a75c7ffd 100644 --- a/tests/test_workers/test_api_utils.py +++ b/tests/test_workers/test_api_utils.py @@ -86,7 +86,10 @@ def test_update_request_connection_failed(mock_session): 'exc_msg, expected', ( (None, 'The worker failed to update the request 3'), - ('Failed to set index_image={index_image}', 'Failed to set index_image=index-image:latest'), + ( + 'Failed to set index_image={index_image} on request {request_id}', + 'Failed to set index_image=index-image:latest on request 3', + ), ), ) @mock.patch('iib.workers.api_utils.requests_auth_session')