64 lines
2.7 KiB
Diff
64 lines
2.7 KiB
Diff
From 27df2fbb6c18c382e7099015915f7efb673a9e06 Mon Sep 17 00:00:00 2001
|
|
From: rabbitali <wenxin32@foxmail.com>
|
|
Date: Tue, 21 Nov 2023 09:02:09 +0800
|
|
Subject: [PATCH] update return log field of the cve fix func
|
|
|
|
---
|
|
ceres/manages/vulnerability_manage.py | 22 ++++++++++++----------
|
|
1 file changed, 12 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/ceres/manages/vulnerability_manage.py b/ceres/manages/vulnerability_manage.py
|
|
index da98297..23ae2ce 100644
|
|
--- a/ceres/manages/vulnerability_manage.py
|
|
+++ b/ceres/manages/vulnerability_manage.py
|
|
@@ -621,11 +621,12 @@ class VulnerabilityManage:
|
|
a tuple containing two elements (update result, log).
|
|
"""
|
|
code, stdout, stderr = execute_shell_command(f"dnf upgrade-en {rpm_name} -y")
|
|
+ log = stdout + stderr
|
|
if code != CommandExitCode.SUCCEED:
|
|
- return TaskExecuteRes.FAIL, stderr
|
|
- if "Complete" not in stdout:
|
|
- return TaskExecuteRes.FAIL, stdout
|
|
- return TaskExecuteRes.SUCCEED, stdout
|
|
+ return TaskExecuteRes.FAIL, log
|
|
+ if "Complete" not in log:
|
|
+ return TaskExecuteRes.FAIL, log
|
|
+ return TaskExecuteRes.SUCCEED, log
|
|
|
|
def _update_hotpatch_by_dnf_plugin(self, hotpatch_pkg: str) -> Tuple[str, str]:
|
|
"""
|
|
@@ -645,22 +646,23 @@ class VulnerabilityManage:
|
|
update_command = f"dnf hotupgrade {hotpatch_pkg} -y"
|
|
|
|
code, stdout, stderr = execute_shell_command(update_command)
|
|
+ log = stdout + stderr
|
|
if code != CommandExitCode.SUCCEED:
|
|
- return TaskExecuteRes.FAIL, stderr
|
|
+ return TaskExecuteRes.FAIL, log
|
|
|
|
if "Apply hot patch succeed" not in stdout and "No hot patches marked for install" not in stdout:
|
|
- return TaskExecuteRes.FAIL, stdout
|
|
+ return TaskExecuteRes.FAIL, log
|
|
|
|
if not self.takeover and self.accepted:
|
|
try:
|
|
hotpatch_name = hotpatch_pkg.rsplit(".", 1)[0].split("-", 1)[1]
|
|
- _, log = self._set_hotpatch_status_by_dnf_plugin(hotpatch_name, "accept")
|
|
- stdout += f"\n\n{log}"
|
|
+ _, hotpatch_status_set_log = self._set_hotpatch_status_by_dnf_plugin(hotpatch_name, "accept")
|
|
+ log += f"\n\n{hotpatch_status_set_log}"
|
|
except IndexError as error:
|
|
LOGGER.error(error)
|
|
- stdout += f"\n\nhotpatch status set failed due to can't get correct hotpatch name!"
|
|
+ log += f"\n\nhotpatch status set failed due to can't get correct hotpatch name!"
|
|
|
|
- return TaskExecuteRes.SUCCEED, stdout
|
|
+ return TaskExecuteRes.SUCCEED, log
|
|
|
|
@staticmethod
|
|
def _set_hotpatch_status_by_dnf_plugin(hotpatch: str, operation: str) -> Tuple[bool, str]:
|
|
--
|
|
2.33.0
|
|
|