71 lines
1.9 KiB
Diff
71 lines
1.9 KiB
Diff
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
|
|
|