1 Star 1 Fork 107

ctyunsystem/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-add-dnf-transaction-timeout.patch 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
t.feng 提交于 2020-09-26 13:42 . add dnf transactions timeout
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ctyunsystem/anaconda.git
git@gitee.com:ctyunsystem/anaconda.git
ctyunsystem
anaconda
anaconda
master

搜索帮助