Backport patch to avoid crash on missing COMPOSE_ID

This commit is contained in:
Lubomír Sedlář 2021-10-04 13:33:45 +02:00
parent 07ecfda69c
commit e38503e36b
2 changed files with 51 additions and 1 deletions

46
1550.patch Normal file
View File

@ -0,0 +1,46 @@
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)

View File

@ -2,12 +2,13 @@
Name: pungi Name: pungi
Version: 4.3.0 Version: 4.3.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: Distribution compose tool Summary: Distribution compose tool
License: GPLv2 License: GPLv2
URL: https://pagure.io/pungi URL: https://pagure.io/pungi
Source0: https://pagure.io/releases/%{name}/%{name}-%{version}.tar.bz2 Source0: https://pagure.io/releases/%{name}/%{name}-%{version}.tar.bz2
Patch0: https://pagure.io/pungi/pull-request/1550.patch
BuildRequires: make BuildRequires: make
BuildRequires: python3-nose BuildRequires: python3-nose
@ -137,6 +138,9 @@ nosetests-3 --exe -e test_variant_repo_rpms
%{_bindir}/%{name}-wait-for-signed-ostree-handler %{_bindir}/%{name}-wait-for-signed-ostree-handler
%changelog %changelog
* Mon Oct 04 2021 Lubomír Sedlář <lsedlar@redhat.com> - 4.3.0-2
- Backport patch to avoid crash on missing COMPOSE_ID
* Wed Sep 15 2021 Lubomír Sedlář <lsedlar@redhat.com> - 4.3.0-1 * Wed Sep 15 2021 Lubomír Sedlář <lsedlar@redhat.com> - 4.3.0-1
- Only build CTS url when configured (lsedlar) - Only build CTS url when configured (lsedlar)
- Require requests_kerberos only when needed (lsedlar) - Require requests_kerberos only when needed (lsedlar)