export migration log
This commit is contained in:
parent
130dcc214c
commit
ee7c2db9dc
70
0016-export-migration-log.patch
Normal file
70
0016-export-migration-log.patch
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
From fa9113d9f5c7ba0d80835d9e5dfb683aca9834a7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: lixin <lixinb@uniontech.com>
|
||||||
|
Date: Mon, 13 Nov 2023 16:33:44 +0800
|
||||||
|
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=81=E7=A7=BB=E6=97=A5?=
|
||||||
|
=?UTF-8?q?=E5=BF=97=E5=AF=BC=E5=87=BA?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
index.py | 1 +
|
||||||
|
views/reports.py | 18 ++++++++++++++++++
|
||||||
|
views/server.py | 1 +
|
||||||
|
3 files changed, 20 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/index.py b/index.py
|
||||||
|
index 505e91f..a392531 100644
|
||||||
|
--- a/index.py
|
||||||
|
+++ b/index.py
|
||||||
|
@@ -36,6 +36,7 @@ mods = {
|
||||||
|
'get_environment_data': server.get_environment_data,
|
||||||
|
'get_repo_arch_info': server.get_repo_arch_info,
|
||||||
|
'get_storage_num': server.get_storage_num,
|
||||||
|
+ 'export_reports': server.export_reports,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/views/reports.py b/views/reports.py
|
||||||
|
index 6295283..c616dfd 100644
|
||||||
|
--- a/views/reports.py
|
||||||
|
+++ b/views/reports.py
|
||||||
|
@@ -22,4 +22,22 @@ def migration_detection(data):
|
||||||
|
migration_log.info(scp_log)
|
||||||
|
except:
|
||||||
|
migration_log.error('export report scp error:%s' % scp_log)
|
||||||
|
+ return 'success'
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def migration_logs(data):
|
||||||
|
+ """
|
||||||
|
+ 迁移日志
|
||||||
|
+ :return:
|
||||||
|
+ """
|
||||||
|
+ agent_ip = data.get('agent_ip')
|
||||||
|
+ info_sql = "select AES_DECRYPT(agent_passwd, 'coco'),agent_username from agent_info where agent_ip='%s'" % agent_ip
|
||||||
|
+ info = DBHelper().execute(info_sql).fetchall()
|
||||||
|
+ scp_log = "sshpass -p %s scp -r %s@%s:/var/tmp/uos-migration/UOS_migration_log*.tar.gz /var/uos-migration/" % \
|
||||||
|
+ (str(info[0][0], encoding="utf-8"), info[0][1], agent_ip)
|
||||||
|
+ try:
|
||||||
|
+ os.system(scp_log)
|
||||||
|
+ migration_log.info(scp_log)
|
||||||
|
+ except:
|
||||||
|
+ migration_log.error('export report scp error:%s' % scp_log)
|
||||||
|
return 'success'
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/views/server.py b/views/server.py
|
||||||
|
index 4cfab8f..7c17a2f 100644
|
||||||
|
--- a/views/server.py
|
||||||
|
+++ b/views/server.py
|
||||||
|
@@ -353,6 +353,7 @@ def get_storage_num(data):
|
||||||
|
|
||||||
|
reports_type = {
|
||||||
|
"migration_detection": reports.migration_detection,
|
||||||
|
+ "migration_logs": reports.migration_logs,
|
||||||
|
}
|
||||||
|
|
||||||
|
def export_reports(data):
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: migration-tools
|
Name: migration-tools
|
||||||
Version: 1.0.3
|
Version: 1.0.3
|
||||||
Release: 15
|
Release: 16
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
@ -22,6 +22,8 @@ Patch012: 0012-get-agent-kernel-version.patch
|
|||||||
Patch013: 0013-set-agent-migration-task.patch
|
Patch013: 0013-set-agent-migration-task.patch
|
||||||
Patch014: 0014-compare-with-request-agent-ip.patch
|
Patch014: 0014-compare-with-request-agent-ip.patch
|
||||||
Patch015: 0015-agent-sends-the-task-after-receving-the-request.patch
|
Patch015: 0015-agent-sends-the-task-after-receving-the-request.patch
|
||||||
|
Patch016: 0016-export-migration-log.patch
|
||||||
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
@ -120,6 +122,9 @@ rm -rf /usr/bin/migration-tools
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-16
|
||||||
|
- 0016-export-migration-log.patch
|
||||||
|
|
||||||
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-15
|
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-15
|
||||||
- 0015-agent-sends-the-task-after-receving-the-request.patch
|
- 0015-agent-sends-the-task-after-receving-the-request.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user