detection of import host information interface

This commit is contained in:
xuezhixin 2024-11-04 16:32:02 +08:00
parent 06b43801bd
commit ed09fb04f1
2 changed files with 101 additions and 1 deletions

View File

@ -0,0 +1,95 @@
From 2dacf8188d8bfb223092ac386768b19cf8f4ab64 Mon Sep 17 00:00:00 2001
From: lixin <lixinb@uniontech.com>
Date: Fri, 10 Nov 2023 10:23:53 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=AF=BC=E5=85=A5=E4=B8=BB?=
=?UTF-8?q?=E6=9C=BA=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.py | 28 ++++++++++++++++++++--------
views/migration.py | 13 +++++++++++++
2 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/index.py b/index.py
index c51a24c..edd4440 100644
--- a/index.py
+++ b/index.py
@@ -29,9 +29,20 @@ mods = {
'host_info_display': server.host_info_display,
'sql_task': server.modify_task_stream,
'delete_host_info': server.delete_host_info,
+ 'check_info': migration.check_info,
}
+def check_methods():
+ if request.method == 'POST':
+ data = request.get_data()
+ json_data = json.loads(data)
+ mod = mods.get(json_data['mod'])
+ if mod:
+ response_str = mod(data)
+ return response_str
+
+
@app.route('/import_host_info', methods=['GET', 'POST'])
def import_host_info():
"""
@@ -76,14 +87,15 @@ def delete_host_info():
return Response(mod, content_type='application/json')
-def check_methods():
- if request.method == 'POST':
- data = request.get_data()
- json_data = json.loads(data)
- mod = mods.get(json_data['mod'])
- if mod:
- response_str = mod(data)
- return response_str
+@app.route('/check_info', methods=['GET', 'POST'])
+def check_info():
+ """
+ 检测系统版本和空间大小
+ :return:
+ """
+ mod = check_methods()
+ if mod:
+ return Response(mod, content_type='application/json')
@app.route('/', methods=['GET', 'POST'])
diff --git a/views/migration.py b/views/migration.py
index f9fe01d..b359d36 100644
--- a/views/migration.py
+++ b/views/migration.py
@@ -1,11 +1,24 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
# SPDX-License-Identifier: MulanPubL-2.0-or-later
import os
+
+from connect_sql import DBHelper
+from logger import *
+
from flask import *
from client_requests import *
from sysmig_agent.utils import *
+def check_info(data):
+ """
+ 检测系统版本和空间大小
+ :param data:
+ :return:
+ """
+ return 'success'
+
+
def check_services(data, url):
info = post_client_data(data, url)
if info is None or info.status_code != 200:
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 17
Release: 18
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
@ -24,6 +24,8 @@ Patch14: 0014-modify-task-stream-interface.patch
Patch15: 0015-delete-host-information-interface.patch
Patch16: 0016-get-local-ip-on-the-agent.patch
Patch17: 0017-add-process-data-in-database.patch
Patch18: 0018-detection-of-imported-host-information-interface.patch
BuildArch: noarch
BuildRequires: systemd
%description
@ -121,6 +123,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-18
- 0018-detection-of-imported-host-information-interface.patch
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-17
- 0017-add-process-data-in-database.patch