Send correct ostree ref to fedmsg

This commit is contained in:
Lubomír Sedlář 2018-12-05 12:23:53 +01:00
parent 0a2e78d7de
commit cb25281541
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From 5f6dcb37f69734229ce2e94528139640c46583aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
Date: Wed, 5 Dec 2018 11:20:17 +0100
Subject: [PATCH] ostree: Send correct ref in the message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If configuration requests a different ref than what treefile has, a
wrong message can be sent.
If the treefile is in JSON, the local copy will be updated in-place and
it works. However with YAML the updated version is still written as JSON
and thus we are still sending the original value.
Fixes: https://pagure.io/pungi/issue/1092
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
---
pungi/phases/ostree.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py
index ae8505ac..8bbe4434 100644
--- a/pungi/phases/ostree.py
+++ b/pungi/phases/ostree.py
@@ -93,8 +93,12 @@ class OSTreeThread(WorkerThread):
extra_config_file=extra_config_file)
if compose.notifier:
- ref = get_ref_from_treefile(os.path.join(repodir, config['treefile']),
- arch, logger=self.pool._logger)
+ original_ref = get_ref_from_treefile(
+ os.path.join(repodir, config["treefile"]),
+ arch,
+ logger=self.pool._logger,
+ )
+ ref = config.get("ostree_ref") or original_ref
# 'pungi-make-ostree tree' writes commitid to commitid.log in
# logdir, except if there was no new commit we will get None
# instead. If the commit id could not be read, an exception will be
--
2.17.2

View File

@ -1,12 +1,13 @@
Name: pungi Name: pungi
Version: 4.1.31 Version: 4.1.31
Release: 1%{?dist} Release: 2%{?dist}
Summary: Distribution compose tool Summary: Distribution compose tool
Group: Development/Tools Group: Development/Tools
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: 0001-ostree-Send-correct-ref-in-the-message.patch
BuildRequires: python3-nose BuildRequires: python3-nose
BuildRequires: python3-mock BuildRequires: python3-mock
@ -193,6 +194,9 @@ nosetests-3 --exe
%{_bindir}/%{name}-wait-for-signed-ostree-handler %{_bindir}/%{name}-wait-for-signed-ostree-handler
%changelog %changelog
* Wed Dec 05 2018 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.31-2
- Send correct ostree ref to fedmsg
* Mon Nov 26 2018 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.31-1 * Mon Nov 26 2018 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.31-1
- Remove patches keeping old ostree phase ordering - Remove patches keeping old ostree phase ordering
- Add script to merge and dump multiple configuration files (lsedlar) - Add script to merge and dump multiple configuration files (lsedlar)