pungi/1550.patch
2021-10-04 13:33:45 +02:00

47 lines
1.5 KiB
Diff

From 911febfa4a655d8577cb2f6c0634e652a8235ae4 Mon Sep 17 00:00:00 2001
From: Lubomír Sedlář <lsedlar@redhat.com>
Date: Sep 14 2021 09:44:45 +0000
Subject: Work around ODCS creating COMPOSE_ID later
When ODCS starts a compose, it will provide base composeinfo file, but
it doesn't create COMPOSE_ID. This leads to a crash when updating CTS,
since the compose id can't be read from the file. We can instead use the
value we already have in memory.
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
---
diff --git a/pungi/compose.py b/pungi/compose.py
index 37f6344..f02df9d 100644
--- a/pungi/compose.py
+++ b/pungi/compose.py
@@ -150,11 +150,9 @@ def write_compose_info(compose_dir, ci):
ci.dump(os.path.join(work_dir, "composeinfo-base.json"))
-def update_compose_url(compose_dir, conf):
+def update_compose_url(compose_id, compose_dir, conf):
import requests
- with open(os.path.join(compose_dir, "COMPOSE_ID"), "r") as f:
- compose_id = f.read()
authentication = get_authentication(conf)
cts_url = conf.get("cts_url", None)
if cts_url:
diff --git a/pungi/scripts/pungi_koji.py b/pungi/scripts/pungi_koji.py
index 6f1b92a..45b25fe 100644
--- a/pungi/scripts/pungi_koji.py
+++ b/pungi/scripts/pungi_koji.py
@@ -329,7 +329,7 @@ def main():
notifier=notifier,
)
- rv = Compose.update_compose_url(compose_dir, conf)
+ rv = Compose.update_compose_url(compose.compose_id, compose_dir, conf)
if rv and not rv.ok:
logger.error("CTS compose_url update failed with the error: %s" % rv.text)