diff --git a/0015-delete-host-information-interface.patch b/0015-delete-host-information-interface.patch new file mode 100644 index 0000000..9fb524a --- /dev/null +++ b/0015-delete-host-information-interface.patch @@ -0,0 +1,83 @@ +From 6725378c0a35beed675d7cb73e1f16c712ece59a Mon Sep 17 00:00:00 2001 +From: lixin +Date: Thu, 9 Nov 2023 17:13:41 +0800 +Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E4=B8=BB?= + =?UTF-8?q?=E6=9C=BA=E6=8E=A5=E5=8F=A3?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + index.py | 13 +++++++++++++ + views/server.py | 23 ++++++++++++++++++++++- + 2 files changed, 35 insertions(+), 1 deletion(-) + +diff --git a/index.py b/index.py +index 059431b..c51a24c 100644 +--- a/index.py ++++ b/index.py +@@ -28,8 +28,10 @@ mods = { + 'import_host_info': server.import_host_info, + 'host_info_display': server.host_info_display, + 'sql_task': server.modify_task_stream, ++ 'delete_host_info': server.delete_host_info, + } + ++ + @app.route('/import_host_info', methods=['GET', 'POST']) + def import_host_info(): + """ +@@ -63,6 +65,17 @@ def modify_task_stream(): + return Response(mod, content_type='application/json') + + ++@app.route('/delete_host_info', methods=['GET', 'POST']) ++def delete_host_info(): ++ """ ++ 删除迁移主机 ++ :return: ++ """ ++ mod = check_methods() ++ if mod: ++ return Response(mod, content_type='application/json') ++ ++ + def check_methods(): + if request.method == 'POST': + data = request.get_data() +diff --git a/views/server.py b/views/server.py +index a00e696..e7570b8 100644 +--- a/views/server.py ++++ b/views/server.py +@@ -161,4 +161,25 @@ def modify_task_stream(data): + modify_task_stream_sql = "update task_stream set stream_status='%s',stream_Updatetime='%s' " \ + "where task_stream_id='%s';" % (task_status, time, task_stream_id) + DBHelper().execute(modify_task_stream_sql) +- return 'success' +\ No newline at end of file ++ return 'success' ++ ++ ++def delete_host_info(data): ++ """ ++ 删除主机信息 ++ :return: ++ """ ++ data = json.loads(data) ++ for i in data.get('agent_ip'): ++ sql = "delete from agent_info where agent_ip='%s';" % i ++ DBHelper().execute(sql) ++ sql = "delete from agent_task where agent_ip='%s';" % i ++ DBHelper().execute(sql) ++ sql = "delete from task_stream where agent_ip='%s';" % i ++ DBHelper().execute(sql) ++ sql = "delete from cur_task where agent_ip='%s';" % i ++ DBHelper().execute(sql) ++ ++ res = {'data': 'success'} ++ json_res = json.dumps(res) ++ return json_res +\ No newline at end of file +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index 17d64fc..6da7767 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 14 +Release: 15 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 @@ -21,6 +21,7 @@ Patch11: 0011-replace-agent-with-func-diractory.patch Patch12: 0012-add-agent_task-in-database.patch Patch13: 0013-display-agent-host-information.patch Patch14: 0014-modify-task-stream-interface.patch +Patch15: 0015-delete-host-information-interface.patch BuildArch: noarch BuildRequires: systemd @@ -119,6 +120,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Mon Nov 4 2024 xuezhixin - 1.0.2-15 +- 0015-delete-host-information-interface.patch + * Mon Nov 4 2024 xuezhixin - 1.0.2-14 - 0014-modify-task-stream-interface.patch