From 60f1dd2b464cd7e425304542d383f0d230cde5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Fri, 9 Aug 2024 16:46:53 +0200 Subject: [PATCH] Audit: Fix undefined output_url --- github_app_geo_project/module/audit/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/github_app_geo_project/module/audit/__init__.py b/github_app_geo_project/module/audit/__init__.py index b8b2626558..bd926a0f66 100644 --- a/github_app_geo_project/module/audit/__init__.py +++ b/github_app_geo_project/module/audit/__init__.py @@ -175,6 +175,8 @@ async def _process_snyk_dpkg( logs_url, env, ) + body_md = body.to_markdown() if body is not None else "" + del body success &= new_success output_url = _process_error( context, @@ -190,20 +192,20 @@ async def _process_snyk_dpkg( _LOGGER.debug(message) if output_url is not None: short_message.append(f"[Output]({output_url})") + if body_md: + body_md += "\n" + body_md += f"[Output]({output_url})" if output_url is not None else "" if context.module_event_data.type == "dpkg": - body = module_utils.HtmlMessage("Update dpkg packages\n") + body_md = "Update dpkg packages" if os.path.exists("ci/dpkg-versions.yaml"): await audit_utils.dpkg( context.module_config.get("dpkg", {}), local_config.get("dpkg", {}) ) - body_md = body.to_markdown() if body is not None else "" - del body body_md += "\n" if body_md else "" body_md += f"[Logs]({logs_url})" - body_md += f"\n[Output]({output_url})" if output_url is not None else "" short_message.append(f"[Logs]({logs_url})") diff_proc = subprocess.run( # nosec # pylint: disable=subprocess-run-check