get repository detection result

This commit is contained in:
xuezhixin 2024-11-06 15:40:24 +08:00
parent 7542c3ccf4
commit 8a6375a07a
2 changed files with 86 additions and 2 deletions

View File

@ -0,0 +1,81 @@
From d99a78a973b264280272bac87590870d598d7541 Mon Sep 17 00:00:00 2001
From: lixin <lixinb@uniontech.com>
Date: Fri, 10 Nov 2023 17:42:17 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=BD=AF=E4=BB=B6=E4=BB=93?=
=?UTF-8?q?=E5=BA=93=E6=A3=80=E6=B5=8B=E7=BB=93=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
views/server.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/views/server.py b/views/server.py
index 71cbb8e..b13d908 100644
--- a/views/server.py
+++ b/views/server.py
@@ -211,4 +211,57 @@ def get_kernel_data(data):
res['num'] = len(info_list)
json_res = json.dumps(res)
- return json_res
\ No newline at end of file
+ return json_res
+
+
+def get_repo_data(data):
+ """
+ 定时检查软件仓库检测结果
+ :return:
+ """
+ task_status_sql = "select agent_id from agent_task where task_status=2"
+ get_task_status = DBHelper().execute(task_status_sql).fetchall()
+ if len(get_task_status) == 0:
+ data = {"centos7_x86": "", "centos8_x86": "", "centos7_aarch64": "", "centos8_aarch64": ""}
+ json_data = json.dumps(data)
+ return json_data
+ else:
+ centos7_x86_sql = "select agent_ip from agent_info where (agent_os='centos7' or agent_os='redhat7') " \
+ "and agent_arch='x86_64' and repo_status=1;"
+
+ centos8_x86_sql = "select agent_ip from agent_info where (agent_os='centos8' or agent_os='redhat8') " \
+ "and agent_arch='x86_64' and repo_status=1;"
+
+ centos7_aarch64_sql = "select agent_ip from agent_info where (agent_os='centos7' or agent_os='redhat7') " \
+ "and agent_arch='aarch64' and repo_status=1;"
+
+ centos8_aarch64_sql = "select agent_ip from agent_info where (agent_os='centos8' or agent_os='redhat8') " \
+ "and agent_arch='aarch64' and repo_status=1;"
+
+ data = {}
+ get_centos7_x86_status = DBHelper().execute(centos7_x86_sql).fetchall()
+ if len(get_centos7_x86_status) == 0:
+ data['centos7_x86'] = 'success'
+ else:
+ data['centos7_x86'] = 'faild'
+
+ get_centos8_x86_status = DBHelper().execute(centos8_x86_sql).fetchall()
+ if len(get_centos8_x86_status) == 0:
+ data['centos8_x86'] = 'success'
+ else:
+ data['centos8_x86'] = 'faild'
+
+ get_centos7_aarch64_status = DBHelper().execute(centos7_aarch64_sql).fetchall()
+ if len(get_centos7_aarch64_status) == 0:
+ data['centos7_aarch64'] = 'success'
+ else:
+ data['centos7_aarch64'] = 'faild'
+
+ get_centos8_aarch64_status = DBHelper().execute(centos8_aarch64_sql).fetchall()
+ if len(get_centos8_aarch64_status) == 0:
+ data['centos8_aarch64'] = 'success'
+ else:
+ data['centos8_aarch64'] = 'faild'
+
+ json_data = json.dumps(data)
+ return json_data
\ No newline at end of file
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 52
Release: 53
License: MulanPSL-2.0
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
Source0: %{name}-%{version}.tar.gz
@ -59,7 +59,7 @@ Patch49: 0049-add-interface-to-check-repository-result.patch
Patch50: 0050-check-free-space-in-system-disk.patch
Patch51: 0051-add-basic-system-detection-information-and-upload-the-database.patch
Patch52: 0052-increase-the-weight-of-abi-detection-result.patch
Patch53: 0053-get-repository-detection-result.patch
BuildArch: noarch
BuildRequires: systemd
@ -158,6 +158,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-53
- 0053-get-repository-detection-result.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-52
- 0052-increase-the-weight-of-abi-detection-result.patch