From ac061b2ea8429b6b6304a1c9c8dd99acffeb83f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 14 Sep 2021 11:44:45 +0200 Subject: [PATCH] Work around ODCS creating COMPOSE_ID later MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ář --- pungi/compose.py | 4 +--- pungi/scripts/pungi_koji.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pungi/compose.py b/pungi/compose.py index 37f63449..f02df9d3 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 aaa5773a..07f8cf83 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)