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