diff --git a/0033-check-system-kernrel.patch b/0033-check-system-kernrel.patch new file mode 100644 index 0000000000000000000000000000000000000000..5737544a1d5318e9e54ad546c90d3ef0f67cafee --- /dev/null +++ b/0033-check-system-kernrel.patch @@ -0,0 +1,76 @@ +From 40d5cb8b4956b7a40ce04c9e54acbecdca196691 Mon Sep 17 00:00:00 2001 +From: lixin +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 + diff --git a/migration-tools.spec b/migration-tools.spec index a27e8f97d90a55935d772fa8f40914348bdce16d..6259d974b222b4427bd5a0c4e92897d71c65280b 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -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 - 1.0.2-33 +- 0033-check-system-kernrel.patch + * Tue Nov 5 2024 xuezhixin - 1.0.2-32 - 0032-add-migration.py-to-migration-function.patch