!31 [sync] PR-30: 优化任务执行日志,新增线程内执行ansible的结果日志

From: @openeuler-sync-bot
Reviewed-by: @Lostwayzxc
Signed-off-by: @Lostwayzxc
This commit is contained in:
openeuler-ci-bot 2021-09-29 12:46:43 +00:00 committed by Gitee
commit 5b18d52682
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 5d3a4e2c819d0901994b01f8a33ee0f4fc55fe90 Mon Sep 17 00:00:00 2001
From: gitee-cmd <chemingdao@huawei.com>
Date: Wed, 29 Sep 2021 19:11:28 +0800
Subject: [PATCH] fix log of task execution
---
aops-manager/aops_manager/deploy_manager/view.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/aops-manager/aops_manager/deploy_manager/view.py b/aops-manager/aops_manager/deploy_manager/view.py
index 8d6811b..7a68742 100644
--- a/aops-manager/aops_manager/deploy_manager/view.py
+++ b/aops-manager/aops_manager/deploy_manager/view.py
@@ -195,13 +195,13 @@ class ExecuteTask(Resource):
Args:
inventory(instance): instance of InventoryBuilder
task_id(str): id of a task.
- Returns:
- bool: The execution flag of the task
"""
res = TaskRunner.run_task(task_id, HostKey.key)
inventory.remove_host_vars_in_inventory()
- LOGGER.info("Task %s execution succeed.", task_id)
- return res
+ if res:
+ LOGGER.error("Task %s execution succeeded.", task_id)
+ return
+ LOGGER.error("Task %s execution failed.", task_id)
class ImportTemplate(Resource):
@@ -284,3 +284,4 @@ class DeleteTemplate(Resource):
verify_res, 'delete', database_url, args)
return jsonify(response)
+
--
2.30.0

View File

@ -1,12 +1,13 @@
Name: A-Ops
Version: v1.1.1
Release: 1
Release: 2
Summary: The intelligent ops toolkit for openEuler
License: MulanPSL2
URL: https://gitee.com/openeuler/A-Ops
Source0: %{name}-%{version}.tar.gz
Source1: A-Ops-web-node-modules.tar.gz
patch0001: 0001-fix-diag-return.patch
patch0002: 0002-fix-log-of-task-execution.patch
# build for gopher
@ -169,6 +170,7 @@ website for A-Ops, deployed by Nginx
%setup
%setup -T -D -a 1
%patch0001 -p1
%patch0002 -p1
cp -r A-Ops-web-node-modules/node_modules aops-web/
%build
@ -490,6 +492,9 @@ fi
%changelog
* Wed Sep 29 2021 chemingdao<chemingdao@huawei.com> - v1.1.1-2
- fix log info of the task execution.
* Sun Sep 26 2021 chemingdao<chemingdao@huawei.com> - v1.1.1-1
- New release 1.1.1, bug fix and new features.
- 1. Web issues fix: display fix and domain management modification.