add create task stream interface
This commit is contained in:
parent
5e8f00f053
commit
6a4c50bf20
62
0010-create-task-stream-interface.patch
Normal file
62
0010-create-task-stream-interface.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From f42944e0769e1514524dfe4ad348ab95dd1503ae Mon Sep 17 00:00:00 2001
|
||||
From: lixin <lixinb@uniontech.com>
|
||||
Date: Thu, 9 Nov 2023 15:28:26 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BB=BB=E5=8A=A1=E6=B5=81?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
views/server.py | 32 +++++++++++++++++++++++++++++++-
|
||||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/views/server.py b/views/server.py
|
||||
index 121993a..d36f013 100644
|
||||
--- a/views/server.py
|
||||
+++ b/views/server.py
|
||||
@@ -1,4 +1,6 @@
|
||||
import json
|
||||
+from datetime import datetime
|
||||
+
|
||||
from connect_sql import DBHelper
|
||||
|
||||
def import_host_info(data):
|
||||
@@ -20,4 +22,32 @@ def import_host_info(data):
|
||||
agent_username = i.get('agent_hostname')
|
||||
agent_passwd = i.get('agent_password')
|
||||
val = ((agent_ip, agent_username, agent_passwd),)
|
||||
- DBHelper().insert(sql, val)
|
||||
\ No newline at end of file
|
||||
+ DBHelper().insert(sql, val)
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+def get_agent_id(agent_ip):
|
||||
+ """
|
||||
+ 获取agent_id
|
||||
+ :param agent_ip:
|
||||
+ :return:
|
||||
+ """
|
||||
+ sql = "select agent_id from agent_info where agent_ip='%s'" % agent_ip
|
||||
+ get_agent_id = DBHelper().execute(sql).fetchall()
|
||||
+ return get_agent_id[0][0]
|
||||
+
|
||||
+
|
||||
+def create_task_stream(agent_ip):
|
||||
+ """
|
||||
+ 创建任务流
|
||||
+ :return:
|
||||
+ """
|
||||
+ create_task_stream_sql = "insert into task_stream(agent_ip,agent_id,stream_status," \
|
||||
+ "stream_CreateTime,stream_Updatetime) values (%s, %s, %s, %s, %s);"
|
||||
+
|
||||
+ stream_status = 'None'
|
||||
+ agent_id = get_agent_id(agent_ip)
|
||||
+ time = datetime.now().strftime('%Y-%-m-%d %H:%M:%S')
|
||||
+ values = ((agent_ip, agent_id, stream_status, time, time),)
|
||||
+ DBHelper().insert(create_task_stream_sql, values)
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 9
|
||||
Release: 10
|
||||
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
|
||||
@ -16,7 +16,7 @@ Patch5: 0006-add-loger-interface-function.patch
|
||||
Patch6: 0007-add-function-to-import-machine.patch
|
||||
Patch7: 0008-add-agent_info-table-in-database.patch
|
||||
Patch8: 0009-add-task_stream-table-in-database.patch
|
||||
|
||||
Patch10: 0010-create-task-stream-interface.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: systemd
|
||||
@ -115,6 +115,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-10
|
||||
- 0010-create-task-stream-interface.patch
|
||||
|
||||
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-9
|
||||
- 0009-add-task_stream-table-in-database.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user