check system kernel

This commit is contained in:
xuezhixin 2024-11-05 19:59:43 +08:00
parent 95201eed94
commit e078f5df14
2 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,76 @@
From 40d5cb8b4956b7a40ce04c9e54acbecdca196691 Mon Sep 17 00:00:00 2001
From: lixin <lixinb@uniontech.com>
Date: Fri, 10 Nov 2023 13:37:59 +0800
Subject: [PATCH] =?UTF-8?q?=E5=86=85=E6=A0=B8=E6=A3=80=E6=B5=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.py | 12 ++++++++++++
views/migration.py | 12 ++++++++++++
2 files changed, 24 insertions(+)
diff --git a/index.py b/index.py
index edd4440..f0bf10d 100644
--- a/index.py
+++ b/index.py
@@ -30,6 +30,7 @@ mods = {
'sql_task': server.modify_task_stream,
'delete_host_info': server.delete_host_info,
'check_info': migration.check_info,
+ 'check_kernel': migration.check_kernel,
}
@@ -98,6 +99,17 @@ def check_info():
return Response(mod, content_type='application/json')
+@app.route('/check_kernel', methods=['GET', 'POST'])
+def check_kernel():
+ """
+ 下发检测agent内核版本和软件仓库内核版本
+ :return:
+ """
+ mod = check_methods()
+ if mod:
+ return Response(mod, content_type='application/json')
+
+
@app.route('/', methods=['GET', 'POST'])
def MT_index():
"""
diff --git a/views/migration.py b/views/migration.py
index 985a1bf..d9ac551 100644
--- a/views/migration.py
+++ b/views/migration.py
@@ -53,6 +53,7 @@ def get_agent_ip(data, sql, url):
task_id = DBHelper().execute(get_task_id_sql).fetchall()
data['task_id'] = task_id[0][0]
json_data = json.dumps(data)
+ send_task_to_agent(json_data, url, list(i)[0])
def check_info(data):
@@ -66,6 +67,17 @@ def check_info(data):
return 'success'
+def check_kernel(data):
+ """
+ 检测agent内核版本和软件仓库内核版本
+ :param data:
+ :return:
+ """
+ sql = "select agent_ip from agent_info where agent_online_status=0 and agent_storage>=10 and repo_status=0;"
+ get_agent_ip(data, sql, '/check_kernel')
+ return 'success'
+
+
def check_services(data, url):
info = post_client_data(data, url)
if info is None or info.status_code != 200:
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 32
Release: 33
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
@ -39,6 +39,8 @@ Patch29: 0029-json-and-list-format-interchange.patch
Patch30: 0030-system-information-import-info-the-database-after-migration.patch
Patch31: 0031-migration-check-and-extract-macros.patch
Patch32: 0032-add-migration.py-to-migration-function.patch
Patch33: 0033-check-system-kernrel.patch
BuildArch: noarch
BuildRequires: systemd
@ -137,6 +139,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-33
- 0033-check-system-kernrel.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-32
- 0032-add-migration.py-to-migration-function.patch