add basic system detection information and updload the database
This commit is contained in:
parent
e9b148c088
commit
3d56705456
@ -0,0 +1,60 @@
|
|||||||
|
From f9cd5557c5dbb1292cb6895d3da47d54af65b40d Mon Sep 17 00:00:00 2001
|
||||||
|
From: xuezhixin <xuezhixin@uniontech.com>
|
||||||
|
Date: Fri, 10 Nov 2023 15:15:58 +0800
|
||||||
|
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A3=80=E6=B5=8B=E7=B3=BB?=
|
||||||
|
=?UTF-8?q?=E7=BB=9F=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E5=B9=B6=E4=B8=8A?=
|
||||||
|
=?UTF-8?q?=E4=BC=A0=E5=88=B0=E6=95=B0=E6=8D=AE=E5=BA=93?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
sysmig_agent/short_task.py | 35 +++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 35 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/sysmig_agent/short_task.py b/sysmig_agent/short_task.py
|
||||||
|
index 23d461b..11dd9ef 100644
|
||||||
|
--- a/sysmig_agent/short_task.py
|
||||||
|
+++ b/sysmig_agent/short_task.py
|
||||||
|
@@ -103,3 +103,38 @@ def check_kernel(data):
|
||||||
|
sql_task_statue(statue, task_id)
|
||||||
|
post_server('task_close', task_id)
|
||||||
|
return 's'
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def check_info(data):
|
||||||
|
+ task_id = json.loads(data).get('task_id')
|
||||||
|
+ # 更新SQL任务状态
|
||||||
|
+ statue = 1
|
||||||
|
+ sql_task_statue(statue, task_id)
|
||||||
|
+ # 发送消息给Server更新任务流状态
|
||||||
|
+ post_server('task_start', task_id)
|
||||||
|
+ # 获取agent系统类型
|
||||||
|
+ agent_os = get_agent_os()
|
||||||
|
+ # agent storage
|
||||||
|
+ agent_storage = os_storage()
|
||||||
|
+ agent_ip = get_local_ip()
|
||||||
|
+ sql = "UPDATE agent_info SET hostname = '{}', agent_os ='{}', agent_arch = '{}' ,agent_storage = {} ," \
|
||||||
|
+ "agent_online_status = {} WHERE agent_ip = '{}';".format(platform.node(), agent_os, platform.machine(),
|
||||||
|
+ agent_storage, 0, agent_ip)
|
||||||
|
+ try:
|
||||||
|
+ DBHelper().execute(sql)
|
||||||
|
+ statue = 2
|
||||||
|
+ except:
|
||||||
|
+ statue = 3
|
||||||
|
+ sql_task_statue(statue, task_id)
|
||||||
|
+ # 更新SQL任务状态
|
||||||
|
+ sql_task_statue(statue, task_id)
|
||||||
|
+ post_server('task_close', task_id)
|
||||||
|
+ return 'success'
|
||||||
|
+
|
||||||
|
+def get_agent_os():
|
||||||
|
+ os_version_ret = platform.dist()
|
||||||
|
+ version = os_version_ret[1].split('.', -1)
|
||||||
|
+ AGENT_OS = os_version_ret[0] + version[0]
|
||||||
|
+ return AGENT_OS
|
||||||
|
+
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: migration-tools
|
Name: migration-tools
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 50
|
Release: 51
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
@ -57,7 +57,7 @@ Patch47: 0047-check-kernel-version-in-repository.patch
|
|||||||
Patch48: 0048-server-send-kernel-detection-task.patch
|
Patch48: 0048-server-send-kernel-detection-task.patch
|
||||||
Patch49: 0049-add-interface-to-check-repository-result.patch
|
Patch49: 0049-add-interface-to-check-repository-result.patch
|
||||||
Patch50: 0050-check-free-space-in-system-disk.patch
|
Patch50: 0050-check-free-space-in-system-disk.patch
|
||||||
|
Patch51: 0051-add-basic-system-detection-information-and-upload-the-database.patch
|
||||||
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -157,6 +157,9 @@ rm -rf /usr/bin/migration-tools
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-51
|
||||||
|
- 0051-add-basic-system-detection-information-and-upload-the-database.patch
|
||||||
|
|
||||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-50
|
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-50
|
||||||
- 0050-check-free-space-in-system-disk.patch
|
- 0050-check-free-space-in-system-disk.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user