From 9520e6381a552e6753840a589d98f1740f9afce7 Mon Sep 17 00:00:00 2001 From: brsf11 Date: Fri, 28 Oct 2022 14:33:01 +0800 Subject: [PATCH] impove rpm_manage --- libs/locallibs/rpm_manage.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/locallibs/rpm_manage.py b/libs/locallibs/rpm_manage.py index 89ac71fd..9fd950ac 100644 --- a/libs/locallibs/rpm_manage.py +++ b/libs/locallibs/rpm_manage.py @@ -76,6 +76,14 @@ def rpm_install(pkgs, node=1, tmpfile=""): mugen_log.logging("info", "pkgs:(%s) is already installed" % pkgs) return 0, None + if "Error: Unable to find a match:" in result: + split_result = result.split('\n') + for row in split_result: + if "Error: Unable to find a match:" in row: + lost_pkgs = row.replace("Error: Unable to find a match: ",'') + mugen_log.logging("Error", "pkgs:(%s) not found" % lost_pkgs) + return 0, None + repoCode, repoList = func( conn=conn, cmd="dnf repolist | awk '{print $NF}' | sed -e '1d;:a;N;$!ba;s/\\n/ /g'",