add dnf transactions timeout

This commit is contained in:
t_feng 2020-09-26 13:42:00 +08:00
parent 4de11987e8
commit 415fe5a410
2 changed files with 61 additions and 1 deletions

View File

@ -1,7 +1,7 @@
%define _empty_manifest_terminate_build 0
Name: anaconda
Version: 33.19
Release: 10
Release: 11
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -36,6 +36,8 @@ Patch6004: bugfix-move-verify-valid-installtree-to-source-module-utils.patch
Patch6005: bugfix-add-tests-for-verify-valid-installtree-function.patch
Patch6006: bugfix-rename-function-for-a-simple-check-for-DNF-repository.patch
Patch9023: bugfix-add-dnf-transaction-timeout.patch
%define dbusver 1.2.3
%define dnfver 3.6.0
%define dracutver 034-7
@ -248,6 +250,12 @@ update-desktop-database &> /dev/null || :
%{_datadir}/gtk-doc
%changelog
* Sat Sep 26 2020 fengtao <fengtao40@huawei.com> - 33.19-11
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:add dnf transactions timeout
* Thu Sep 17 2020 zhuqingfu <zhuqingfu1@huawei.com> - 33.19-10
- Type:bugfix
- ID:NA

View File

@ -0,0 +1,52 @@
From d1bb8d1d49de9668e8afc697aef8166d6c5bfabe Mon Sep 17 00:00:00 2001
From: t_feng <fengtao40@huawei.com>
Date: Fri, 25 Sep 2020 23:16:04 +0800
Subject: [PATCH] add dnf transaction timeout
---
pyanaconda/core/constants.py | 3 +++
pyanaconda/payload/dnf/payload.py | 7 ++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py
index 0e4cc15..607f96c 100644
--- a/pyanaconda/core/constants.py
+++ b/pyanaconda/core/constants.py
@@ -448,6 +448,9 @@ URL_TYPE_BASEURL = "BASEURL"
URL_TYPE_MIRRORLIST = "MIRRORLIST"
URL_TYPE_METALINK = "METALINK"
+#DNF trasactions timeout
+DNF_TRANSACTIONS_TIMEOUT = 1800
+
# The default source for the DNF payload.
DNF_DEFAULT_SOURCE_TYPE = SOURCE_TYPE_CLOSEST_MIRROR
diff --git a/pyanaconda/payload/dnf/payload.py b/pyanaconda/payload/dnf/payload.py
index f927208..08963cc 100644
--- a/pyanaconda/payload/dnf/payload.py
+++ b/pyanaconda/payload/dnf/payload.py
@@ -19,6 +19,7 @@
import configparser
import functools
import multiprocessing
+import queue
import os
import shutil
import sys
@@ -1356,7 +1357,11 @@ class DNFPayload(Payload):
if errors.errorHandler.cb(exc) == errors.ERROR_RAISE:
log.error("Installation failed: %r", exc)
go_to_failure_limbo()
- (token, msg) = queue_instance.get()
+ try:
+ (token, msg) = queue_instance.get(True, constants.DNF_TRANSACTIONS_TIMEOUT)
+ except queue.Empty:
+ msg = ("Payload error - DNF installation has timeouted")
+ raise PayloadError(msg)
process.join()
# Don't close the mother base here, because we still need it.
--
2.23.0