This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 416ceaa  Improve logging for KEYS file regeneration
416ceaa is described below

commit 416ceaa3b8c9336e898553ee868114f1ad6ad325
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue Jun 17 19:26:19 2025 +0100

    Improve logging for KEYS file regeneration
---
 atr/blueprints/admin/admin.py | 22 +++++++++++-----------
 atr/routes/keys.py            |  1 +
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/atr/blueprints/admin/admin.py b/atr/blueprints/admin/admin.py
index 848ce8d..62f2c82 100644
--- a/atr/blueprints/admin/admin.py
+++ b/atr/blueprints/admin/admin.py
@@ -374,11 +374,11 @@ async def admin_keys_regenerate_all() -> quart.Response:
         )
 
     try:
-        okay, failed = await _regenerate_keys_all()
-        return quart.Response(
-            f"KEYS file regeneration results: {okay} okay, {failed} failed",
-            mimetype="text/plain",
-        )
+        okay, failures = await _regenerate_keys_all()
+        msg = f"KEYS file regeneration results: {okay} okay, {len(failures)} 
failed"
+        if failures:
+            msg += f"\nFailures:\n{'\n'.join(failures)}"
+        return quart.Response(msg, mimetype="text/plain")
     except Exception as e:
         return quart.Response(f"Exception during KEYS file regeneration: 
{e!s}", mimetype="text/plain")
 
@@ -751,22 +751,22 @@ def _project_status(
     return models.ProjectStatus.ACTIVE
 
 
-async def _regenerate_keys_all() -> tuple[int, int]:
+async def _regenerate_keys_all() -> tuple[int, list[str]]:
     okay = 0
-    failed = 0
+    failures = []
     async with db.session() as data:
         committees = await data.committee().all()
         for committee in committees:
             try:
                 error_msg = await keys.autogenerate_keys_file(committee.name, 
caller_data=data)
-            except Exception:
-                failed += 1
+            except Exception as e:
+                failures.append(f"Caller error regenerating KEYS file for 
committee {committee.name}: {e!s}")
                 continue
             if error_msg:
-                failed += 1
+                failures.append(error_msg)
             else:
                 okay += 1
-    return okay, failed
+    return okay, failures
 
 
 def _session_data(
diff --git a/atr/routes/keys.py b/atr/routes/keys.py
index d249308..80f67c0 100644
--- a/atr/routes/keys.py
+++ b/atr/routes/keys.py
@@ -655,6 +655,7 @@ async def _write_keys_file(
 ) -> str | None:
     try:
         await asyncio.to_thread(committee_keys_dir.mkdir, parents=True, 
exist_ok=True)
+        await asyncio.to_thread(util.chmod_directories, committee_keys_dir, 
permissions=0o755)
         await asyncio.to_thread(committee_keys_path.write_text, 
full_keys_file_content, encoding="utf-8")
     except OSError as e:
         error_msg = f"Failed to write KEYS file for committee 
{committee_name}: {e}"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to