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-releases.git
The following commit(s) were added to refs/heads/main by this push:
new a90a40a Fix some problems with the admin script to import keys
a90a40a is described below
commit a90a40ac767e9b79070ff0f72c646894ea193ec9
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue Jan 27 16:14:47 2026 +0000
Fix some problems with the admin script to import keys
---
atr/admin/__init__.py | 9 +++++++--
scripts/keys_import.py | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/atr/admin/__init__.py b/atr/admin/__init__.py
index bef7fb6..5037a5e 100644
--- a/atr/admin/__init__.py
+++ b/atr/admin/__init__.py
@@ -479,7 +479,7 @@ async def keys_update_get(session: web.Committer) -> str |
web.WerkzeugResponse
form_classes="",
)
# TODO: All known file paths should be constants
- log_path = pathlib.Path("logs") / "keys-import.log"
+ log_path = pathlib.Path(config.get().STATE_DIR) / "logs" /
"keys-import.log"
if not await aiofiles.os.path.exists(log_path):
previous_output = None
else:
@@ -493,6 +493,7 @@ async def keys_update_post(session: web.Committer) -> str |
web.WerkzeugResponse
"""Update keys from remote data."""
try:
pid = await _update_keys(session.asf_uid)
+ log.info(f"Keys update process started with PID {pid}")
return {
"message": f"Successfully started key update process with PID
{pid}",
"category": "success",
@@ -1135,6 +1136,10 @@ async def _update_keys(asf_uid: str) -> int:
async def _log_process(process: asyncio.subprocess.Process) -> None:
try:
stdout, stderr = await process.communicate()
+ if process.returncode != 0:
+ log.error(f"keys_import.py exited with code
{process.returncode}")
+ else:
+ log.info(f"keys_import.py exited with code
{process.returncode}")
if stdout:
log.info(f"keys_import.py
stdout:\n{stdout.decode('utf-8')[:1000]}")
if stderr:
@@ -1148,7 +1153,7 @@ async def _update_keys(asf_uid: str) -> int:
if await aiofiles.os.path.exists("../Dockerfile.alpine"):
# Not in a container, developing locally
- command = ["poetry", "run", "python3", "scripts/keys_import.py",
asf_uid]
+ command = ["uv", "run", "--frozen", "python3",
"scripts/keys_import.py", asf_uid]
else:
# In a container
command = [sys.executable, "scripts/keys_import.py", asf_uid]
diff --git a/scripts/keys_import.py b/scripts/keys_import.py
index b026871..c12d8b5 100755
--- a/scripts/keys_import.py
+++ b/scripts/keys_import.py
@@ -120,7 +120,7 @@ def log_outcome_errors(outcomes: outcome.List[types.Key],
committee_name: str) -
@contextlib.contextmanager
def log_to_file(conf: config.AppConfig):
- log_file_path = os.path.join(conf.STATE_DIR, "keys-import.log")
+ log_file_path = os.path.join(conf.STATE_DIR, "logs", "keys-import.log")
# This should not be required
os.makedirs(conf.STATE_DIR, exist_ok=True)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]