From f4604d225a9db3e9c18c3eb8de5cde28cd7c2c55 Mon Sep 17 00:00:00 2001
From: lixin <lixinb@uniontech.com>
Date: Mon, 13 Nov 2023 09:52:09 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8E=AF=E5=A2=83=E6=A3=80?=
 =?UTF-8?q?=E6=9F=A5=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 views/migration.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/views/migration.py b/views/migration.py
index a628694..b7eaefa 100644
--- a/views/migration.py
+++ b/views/migration.py
@@ -88,9 +88,21 @@ def check_services(data, url):
 
 
 def check_environment(data):
-    services = check_services(data, '/check_environment')
-    if services:
-        return services
+    """
+    agent迁移前环境检查任务
+    :param data:
+    :return:
+    """
+    agent_ip_list = json.loads(data).get('agent_ip')
+    data = json.loads(data)
+    url = '/check_environment'
+    for i in agent_ip_list:
+        get_task_id_sql = "select task_id from cur_task where agent_ip='%s'" % i
+        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, i)
+    return 'success'
 
 
 def check_os(data):
-- 
2.20.1

