!60 add function to import machine
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
ab570b8793
70
0007-add-function-to-import-machine.patch
Normal file
70
0007-add-function-to-import-machine.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From 8024e49a1416a322625fe36c80621301e2a89d73 Mon Sep 17 00:00:00 2001
|
||||
From: lixin <lixinb@uniontech.com>
|
||||
Date: Thu, 9 Nov 2023 13:51:43 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=BB=E6=9C=BA=E5=AF=BC?=
|
||||
=?UTF-8?q?=E5=85=A5=E6=8E=A5=E5=8F=A3?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
index.py | 12 +++++++++++-
|
||||
views/server.py | 13 +++++++++++++
|
||||
2 files changed, 24 insertions(+), 1 deletion(-)
|
||||
create mode 100644 views/server.py
|
||||
|
||||
diff --git a/index.py b/index.py
|
||||
index 6a5fc72..a505915 100644
|
||||
--- a/index.py
|
||||
+++ b/index.py
|
||||
@@ -7,7 +7,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
from func import share
|
||||
-from views import migration
|
||||
+from views import migration, server
|
||||
|
||||
from flask import Flask, render_template, url_for, request, redirect, make_response, session, Response
|
||||
app = Flask(__name__)
|
||||
@@ -26,8 +26,18 @@ mods = {
|
||||
'export_migration_reports': migration.export_migration_reports,
|
||||
'system_migration': migration.system_migration,
|
||||
'migration_details': migration.migration_details,
|
||||
+ 'import_host_info': server.import_host_info,
|
||||
}
|
||||
|
||||
+@app.route('/import_host_info', methods=['GET', 'POST'])
|
||||
+def import_host_info():
|
||||
+ """
|
||||
+ 导入主机信息
|
||||
+ :return:
|
||||
+ """
|
||||
+ mod = check_methods()
|
||||
+ if mod:
|
||||
+ return Response(mod, content_type='application/json')
|
||||
|
||||
def check_methods():
|
||||
if request.method == 'POST':
|
||||
diff --git a/views/server.py b/views/server.py
|
||||
new file mode 100644
|
||||
index 0000000..764d5bd
|
||||
--- /dev/null
|
||||
+++ b/views/server.py
|
||||
@@ -0,0 +1,13 @@
|
||||
+import json
|
||||
+
|
||||
+def import_host_info(data):
|
||||
+ """
|
||||
+ 导入agent主机信息
|
||||
+ :param data:
|
||||
+ :return:
|
||||
+ """
|
||||
+ agent_info = json.loads(data).get("data")
|
||||
+ if not agent_info:
|
||||
+ data = {"data": "faild"}
|
||||
+ json_data = json.dumps(data)
|
||||
+ return json_data
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.20.1
|
||||
|
||||
BIN
migration-tools-1.0.2.tar.gz
Normal file
BIN
migration-tools-1.0.2.tar.gz
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 6
|
||||
Release: 7
|
||||
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
|
||||
@ -12,7 +12,8 @@ Patch1: 0002-modify-excel-report-content.patch
|
||||
Patch2: 0003-delete-redundant-code.patch
|
||||
Patch3: 0004-connect-sql-function.patch
|
||||
Patch4: 0005-execution-sql-function.patch
|
||||
Patch5: 0006-add-loger-interface-function.patc
|
||||
Patch5: 0006-add-loger-interface-function.patch
|
||||
Patch6: 0007-add-function-to-import-machine.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: systemd
|
||||
@ -111,8 +112,11 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-7
|
||||
- 0007-add-function-to-import-machine.patch
|
||||
|
||||
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-6
|
||||
- 0006-add-loger-interface-function.patc
|
||||
- 0006-add-loger-interface-function.patch
|
||||
|
||||
* Fri Nov 1 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-5
|
||||
- add 0005-execution-sql-function.patch
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user