diff --git a/0008-add-agent_info-table-in-database.patch b/0008-add-agent_info-table-in-database.patch new file mode 100644 index 0000000000000000000000000000000000000000..2d4ed611b20848eb83c842716a50b58495470931 --- /dev/null +++ b/0008-add-agent_info-table-in-database.patch @@ -0,0 +1,97 @@ +From dbca836df232ed21f05798878dfb1773501fd4c2 Mon Sep 17 00:00:00 2001 +From: lixin +Date: Thu, 9 Nov 2023 14:16:49 +0800 +Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=B7=BB=E5=8A=A0ag?= + =?UTF-8?q?ent=5Finfo=E8=A1=A8?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + uos-sysmig.sql | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ + views/server.py | 10 +++++++++- + 2 files changed, 61 insertions(+), 1 deletion(-) + create mode 100644 uos-sysmig.sql + +diff --git a/uos-sysmig.sql b/uos-sysmig.sql +new file mode 100644 +index 0000000..eaf8aed +--- /dev/null ++++ b/uos-sysmig.sql +@@ -0,0 +1,52 @@ ++-- MySQL dump 10.13 Distrib 8.0.27, for Linux (x86_64) ++-- ++-- Host: 10.12.21.200 Database: uos-sysmig ++-- ------------------------------------------------------ ++-- Server version 8.0.27 ++ ++/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; ++/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; ++/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; ++/*!50503 SET NAMES utf8 */; ++/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; ++/*!40103 SET TIME_ZONE='+00:00' */; ++/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; ++/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; ++/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; ++/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; ++ ++-- ++-- Table structure for table `agent_info` ++-- ++ ++DROP TABLE IF EXISTS `agent_info`; ++/*!40101 SET @saved_cs_client = @@character_set_client */; ++/*!50503 SET character_set_client = utf8mb4 */; ++CREATE TABLE `agent_info` ( ++ `agent_id` int NOT NULL AUTO_INCREMENT, ++ `agent_ip` varchar(256) NOT NULL, ++ `agent_username` varchar(256) NOT NULL, ++ `agent_passwd` varbinary(256) NOT NULL, ++ `hostname` varchar(256) DEFAULT NULL, ++ `agent_os` varchar(256) DEFAULT NULL, ++ `agent_arch` varchar(45) DEFAULT NULL, ++ `agent_storage` int DEFAULT NULL, ++ `agent_kernel` varchar(45) DEFAULT NULL, ++ `agent_repo_kernel` varchar(256) DEFAULT NULL, ++ `agent_migration_os` varchar(256) DEFAULT NULL, ++ `agent_history_faild_reason` varchar(45) DEFAULT NULL, ++ `agent_online_status` int DEFAULT '0', ++ `repo_status` int DEFAULT NULL, ++ PRIMARY KEY (`agent_id`), ++ KEY `agent_ip` (`agent_ip`) ++) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ++/*!40101 SET character_set_client = @saved_cs_client */; ++ ++-- ++-- Dumping data for table `agent_info` ++-- ++ ++LOCK TABLES `agent_info` WRITE; ++/*!40000 ALTER TABLE `agent_info` DISABLE KEYS */; ++/*!40000 ALTER TABLE `agent_info` ENABLE KEYS */; ++UNLOCK TABLES; +\ No newline at end of file +diff --git a/views/server.py b/views/server.py +index 764d5bd..65ddba9 100644 +--- a/views/server.py ++++ b/views/server.py +@@ -10,4 +10,12 @@ def import_host_info(data): + if not agent_info: + data = {"data": "faild"} + json_data = json.dumps(data) +- return json_data +\ No newline at end of file ++ return json_data ++ ++ ++ sql = "insert into agent_info(agent_ip, agent_username, agent_passwd) values (%s, %s, AES_ENCRYPT(%s, 'coco'));" ++ for i in agent_info: ++ agent_ip = i.get('agent_ip') ++ agent_username = i.get('agent_hostname') ++ agent_passwd = i.get('agent_password') ++ val = ((agent_ip, agent_username, agent_passwd),) +\ No newline at end of file +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index cbf591cc1dbebcea32a088f0da7c854db03ef9f6..e339aeedc42417a3f410919d35beb7781f4fa7e4 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 7 +Release: 8 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 @@ -14,6 +14,7 @@ Patch3: 0004-connect-sql-function.patch Patch4: 0005-execution-sql-function.patch Patch5: 0006-add-loger-interface-function.patch Patch6: 0007-add-function-to-import-machine.patch +Patch7: 0008-add-agent_info-table-in-database.patch BuildArch: noarch BuildRequires: systemd @@ -112,6 +113,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Mon Nov 4 2024 xuezhixin - 1.0.2-8 +- 0008-add-agent_info-table-in-database.patch + * Mon Nov 4 2024 xuezhixin - 1.0.2-7 - 0007-add-function-to-import-machine.patch