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 2841f81  Use committee objects to ensure consistent committee metadata
2841f81 is described below

commit 2841f81a99bd7f92a7cf13c14c082d5b5c43aa46
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Jun 18 18:59:05 2025 +0100

    Use committee objects to ensure consistent committee metadata
---
 atr/construct.py    | 24 +++++++++++++-----------
 atr/routes/draft.py |  2 --
 atr/tasks/vote.py   |  2 --
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/atr/construct.py b/atr/construct.py
index 17a7313..fad7910 100644
--- a/atr/construct.py
+++ b/atr/construct.py
@@ -38,8 +38,6 @@ class AnnounceReleaseOptions:
 class StartVoteOptions:
     asfuid: str
     fullname: str
-    committee_name: str
-    is_podling: bool
     project_name: str
     version_name: str
     vote_duration: int
@@ -63,7 +61,9 @@ async def announce_release_body(body: str, options: 
AnnounceReleaseOptions) -> s
             _committee=True,
             phase=models.ReleasePhase.RELEASE_PREVIEW,
         ).demand(RuntimeError(f"Release {options.project_name} 
{options.version_name} not found"))
-        committee_name = release.committee.display_name if release.committee 
else release.project.display_name
+        if not release.committee:
+            raise RuntimeError(f"Release {options.project_name} 
{options.version_name} has no committee")
+        committee = release.committee
 
     routes_release_view = routes_release.view  # type: ignore[has-type]
     download_path = util.as_url(
@@ -73,7 +73,7 @@ async def announce_release_body(body: str, options: 
AnnounceReleaseOptions) -> s
     download_url = f"https://{host}{download_path}";
 
     # Perform substitutions in the body
-    body = body.replace("[COMMITTEE]", committee_name)
+    body = body.replace("[COMMITTEE]", committee.display_name)
     body = body.replace("[DOWNLOAD_URL]", download_url)
     body = body.replace("[PROJECT]", options.project_name)
     body = body.replace("[VERSION]", options.version_name)
@@ -101,6 +101,9 @@ async def start_vote_body(body: str, options: 
StartVoteOptions) -> str:
             _project=True,
             _committee=True,
         ).demand(RuntimeError(f"Release {options.project_name} 
{options.version_name} not found"))
+        if not release.committee:
+            raise RuntimeError(f"Release {options.project_name} 
{options.version_name} has no committee")
+        committee = release.committee
 
     try:
         host = quart.request.host
@@ -108,18 +111,17 @@ async def start_vote_body(body: str, options: 
StartVoteOptions) -> str:
         host = config.get().APP_HOST
 
     review_url = 
f"https://{host}/vote/{options.project_name}/{options.version_name}";
-    committee_name = release.committee.display_name if release.committee else 
release.project.display_name
     project_short_display_name = release.project.short_display_name if 
release.project else options.project_name
 
     keys_file = None
-    if options.is_podling:
-        keys_file_path = util.get_downloads_dir() / "incubator" / 
options.committee_name / "KEYS"
+    if committee.is_podling:
+        keys_file_path = util.get_downloads_dir() / "incubator" / 
committee.name / "KEYS"
         if await aiofiles.os.path.isfile(keys_file_path):
-            keys_file = 
f"https://{host}/downloads/incubator/{options.committee_name}/KEYS";
+            keys_file = 
f"https://{host}/downloads/incubator/{committee.name}/KEYS";
     else:
-        keys_file_path = util.get_downloads_dir() / options.committee_name / 
"KEYS"
+        keys_file_path = util.get_downloads_dir() / committee.name / "KEYS"
         if await aiofiles.os.path.isfile(keys_file_path):
-            keys_file = 
f"https://{host}/downloads/{options.committee_name}/KEYS";
+            keys_file = f"https://{host}/downloads/{committee.name}/KEYS";
 
     checklist_content = ""
     async with db.session() as data:
@@ -129,7 +131,7 @@ async def start_vote_body(body: str, options: 
StartVoteOptions) -> str:
 
     # Perform substitutions in the body
     # TODO: Handle the DURATION == 0 case
-    body = body.replace("[COMMITTEE]", committee_name)
+    body = body.replace("[COMMITTEE]", committee.display_name)
     body = body.replace("[DURATION]", str(options.vote_duration))
     body = body.replace("[KEYS_FILE]", keys_file or "[Sorry, the KEYS file is 
missing!]")
     body = body.replace("[PROJECT]", project_short_display_name)
diff --git a/atr/routes/draft.py b/atr/routes/draft.py
index 1e92f25..76e5a96 100644
--- a/atr/routes/draft.py
+++ b/atr/routes/draft.py
@@ -501,8 +501,6 @@ async def vote_preview(
         construct.StartVoteOptions(
             asfuid=asfuid,
             fullname=session.fullname,
-            committee_name=release.committee.display_name,
-            is_podling=release.committee.is_podling,
             project_name=project_name,
             version_name=version_name,
             vote_duration=vote_duration,
diff --git a/atr/tasks/vote.py b/atr/tasks/vote.py
index d651003..68742f5 100644
--- a/atr/tasks/vote.py
+++ b/atr/tasks/vote.py
@@ -115,8 +115,6 @@ async def _initiate_core_logic(args: Initiate) -> dict[str, 
Any]:
         construct.StartVoteOptions(
             asfuid=args.initiator_id,
             fullname=args.initiator_fullname,
-            committee_name=release.committee.display_name,
-            is_podling=release.committee.is_podling,
             project_name=release.project.name,
             version_name=release.version,
             vote_duration=args.vote_duration,


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

Reply via email to