From 0e0d63d10ebbd4ee9a0f755e2a1178a69e3d6d9e Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Fri, 10 Nov 2023 15:05:30 +0800
Subject: [PATCH] =?UTF-8?q?server=E4=B8=8B=E5=8F=91=E6=A3=80=E6=B5=8B?=
 =?UTF-8?q?=E5=86=85=E6=A0=B8=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 sysmig_agent/short_task.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/sysmig_agent/short_task.py b/sysmig_agent/short_task.py
index 1e1a1c8..23d461b 100644
--- a/sysmig_agent/short_task.py
+++ b/sysmig_agent/short_task.py
@@ -77,3 +77,29 @@ def os_repo_kernel():
                     else:
                         str_kernel = str_kernel + ',' + kernel_version.strip()
     return str_kernel
+
+
+
+def check_kernel(data):
+    task_id = json.loads(data).get('task_id')
+    # 更新SQL任务开始状态
+    sql_task_statue('1', task_id)
+    # 发送消息给Server更新任务流状态
+    post_server('task_start', task_id )
+    # agent kernel
+    agent_kernel = os_kernel()
+    # agent repo kernel
+    agent_repo_kernel = os_repo_kernel()
+    agent_ip = get_local_ip()
+    statue = 1
+    sql = "UPDATE agent_info SET agent_kernel = '{}',agent_repo_kernel = '{}' WHERE agent_ip = '{}';".format(
+        agent_kernel, agent_repo_kernel, agent_ip)
+    try:
+        DBHelper().execute(sql)
+        statue = 2
+    except:
+        statue = 3
+        sql_task_statue(statue, task_id)
+    sql_task_statue(statue, task_id)
+    post_server('task_close', task_id)
+    return 's'
-- 
2.20.1

