Backport patch Return an error when transaction fails
Resolves: rhbz#2170093
This commit is contained in:
parent
3b79d5edcb
commit
3276f33477
@ -0,0 +1,39 @@
|
||||
From 46aeabda1980621ca0f87528e0a81b4f59d886f0 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kolarik <jkolarik@redhat.com>
|
||||
Date: Thu, 20 Apr 2023 10:10:14 +0000
|
||||
Subject: [PATCH] automatic: Return an error when transaction fails
|
||||
(RhBug:2170093)
|
||||
|
||||
In case of no global error occurred within the transaction, we still need to check state of individual transaction items for any failure.
|
||||
|
||||
This is matching the logic in `BaseCli.do_transaction` method, where the error is emitted after printing the transaction summary.
|
||||
|
||||
= changelog =
|
||||
msg: automatic: Return an error when transaction fails
|
||||
type: bugfix
|
||||
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2170093
|
||||
---
|
||||
dnf/automatic/main.py | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/dnf/automatic/main.py b/dnf/automatic/main.py
|
||||
index 93ce13cc..ccd9ab64 100644
|
||||
--- a/dnf/automatic/main.py
|
||||
+++ b/dnf/automatic/main.py
|
||||
@@ -346,6 +346,13 @@ def main(args):
|
||||
|
||||
gpgsigcheck(base, trans.install_set)
|
||||
base.do_transaction()
|
||||
+
|
||||
+ # In case of no global error occurred within the transaction,
|
||||
+ # we need to check state of individual transaction items.
|
||||
+ for tsi in trans:
|
||||
+ if tsi.state == libdnf.transaction.TransactionItemState_ERROR:
|
||||
+ raise dnf.exceptions.Error(_('Transaction failed'))
|
||||
+
|
||||
emitters.notify_applied()
|
||||
emitters.commit()
|
||||
except dnf.exceptions.Error as exc:
|
||||
--
|
||||
2.40.1
|
||||
|
6
dnf.spec
6
dnf.spec
@ -66,7 +66,7 @@ It supports RPMs, modules and comps groups & environments.
|
||||
|
||||
Name: dnf
|
||||
Version: 4.7.0
|
||||
Release: 17%{?dist}
|
||||
Release: 18%{?dist}
|
||||
Summary: %{pkg_summary}
|
||||
# For a breakdown of the licensing, see PACKAGE-LICENSING
|
||||
License: GPLv2+
|
||||
@ -118,6 +118,7 @@ Patch0039: 0039-Ignore-processing-variable-files-with-unsupported-en.patch
|
||||
Patch0040: 0040-Update-translations.patch
|
||||
Patch0041: 0041-Omit-src-RPMs-from-check-update-RhBug-2151910.patch
|
||||
Patch0042: 0042-Backport-automatic-Fix-onl-detect-proxy-RhBz2022440.patch
|
||||
Patch0043: 0043-automatic-Return-an-error-when-transaction-fails-RhB.patch
|
||||
|
||||
|
||||
BuildArch: noarch
|
||||
@ -418,6 +419,9 @@ popd
|
||||
%{python3_sitelib}/%{name}/automatic/
|
||||
|
||||
%changelog
|
||||
* Wed May 31 2023 Nicola Sella <nsella@redhat.com> - 4.7.0-18
|
||||
- Return an error when transaction fails (RhBug:2170093)
|
||||
|
||||
* Wed May 17 2023 Jaroslav Rohel <jrohel@redhat.com> - 4.7.0-17
|
||||
- Omit src RPMs from check-update (RhBug:2151910,2203069)
|
||||
- automatic: Fix online detection with proxy (RhBug:2022440,2189851)
|
||||
|
Loading…
Reference in New Issue
Block a user