From 699d0feb5d4ed63a3618f368b86858425ce66f8f Mon Sep 17 00:00:00 2001 From: samiat4911 Date: Fri, 27 Feb 2026 19:28:48 +0100 Subject: [PATCH] fix(sonarqube): handle missing service_key_1 in test_product_connection --- dojo/tools/api_sonarqube/api_client.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dojo/tools/api_sonarqube/api_client.py b/dojo/tools/api_sonarqube/api_client.py index 91a7673c812..e7d78fae1da 100644 --- a/dojo/tools/api_sonarqube/api_client.py +++ b/dojo/tools/api_sonarqube/api_client.py @@ -496,9 +496,14 @@ def test_connection(self): def test_product_connection(self, api_scan_configuration): organization = api_scan_configuration.service_key_2 or None - project = self.get_project( - api_scan_configuration.service_key_1, organization=organization, - ) + if api_scan_configuration.service_key_1: + project = self.get_project( + api_scan_configuration.service_key_1, organization=organization, + ) + else: + project = self.find_project( + api_scan_configuration.product.name, organization=organization, + ) project_name = project.get("name") message_prefix = "You have access to project" return (