diff --git a/github_app_geo_project/module/audit/__init__.py b/github_app_geo_project/module/audit/__init__.py index ae9660cdda0..c8b93e7bc24 100644 --- a/github_app_geo_project/module/audit/__init__.py +++ b/github_app_geo_project/module/audit/__init__.py @@ -196,32 +196,29 @@ async def _process_snyk_dpkg( if line.startswith("python "): python_version = ".".join(line.split(" ")[1].split(".")[0:2]).strip() break - try: - if python_version: - _use_python_version(python_version) - logs_url = urllib.parse.urljoin(context.service_url, f"logs/{context.job_id}") - result, body, short_message, new_success = await audit_utils.snyk( - branch, context.module_config.get("snyk", {}), local_config.get("snyk", {}), logs_url - ) - success &= new_success - output_url = _process_error( - context, - key, - issue_check, - [{"title": m.title, "children": [m.to_html("no-title")]} for m in result], - ", ".join(short_message), - ) - message: module_utils.Message = module_utils.HtmlMessage( - "Output" % output_url - ) - message.title = "Output URL" - _LOGGER.debug(message) - if output_url is not None: - short_message.append(f"[See also]({output_url})") - finally: - if python_version: - _use_python_version("3.10") + if python_version: + _use_python_version(python_version) + + logs_url = urllib.parse.urljoin(context.service_url, f"logs/{context.job_id}") + result, body, short_message, new_success = await audit_utils.snyk( + branch, context.module_config.get("snyk", {}), local_config.get("snyk", {}), logs_url + ) + success &= new_success + output_url = _process_error( + context, + key, + issue_check, + [{"title": m.title, "children": [m.to_html("no-title")]} for m in result], + ", ".join(short_message), + ) + message: module_utils.Message = module_utils.HtmlMessage( + "Output" % output_url + ) + message.title = "Output URL" + _LOGGER.debug(message) + if output_url is not None: + short_message.append(f"[See also]({output_url})") if context.module_event_data.type == "dpkg": body = module_utils.HtmlMessage("Update dpkg packages")