fix export log and migration report error

fix no migration detail error
This commit is contained in:
lixin 2023-08-21 17:18:27 +08:00
parent e52230b33e
commit f7d2ac5c1e
3 changed files with 94 additions and 10 deletions

View File

@ -0,0 +1,72 @@
From 854c1d018b9a5f1079f387101c62f86009c3baac Mon Sep 17 00:00:00 2001
From: Super User <root@localhost.localdomain>
Date: Mon, 21 Aug 2023 16:19:47 +0800
Subject: [PATCH] fix export error and no migration details issue
---
ut-Migration-tools/index.py | 4 ++--
ut-Migration-tools/templates/MT_migration.html | 3 ++-
ut-Migration-tools/views/migration.py | 6 +++++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ut-Migration-tools/index.py b/ut-Migration-tools/index.py
index 59e6830..635c5ac 100644
--- a/ut-Migration-tools/index.py
+++ b/ut-Migration-tools/index.py
@@ -218,7 +218,7 @@ def MT_export_migration_reports():
:return:
"""
mod = check_methods()
- f = open("/usr/lib/migration-tools-agent/.passwd.txt","r")
+ f = open("/usr/lib/migration-tools-server/.passwd.txt","r")
password = f.read()
f.close()
if mod:
@@ -234,7 +234,7 @@ def MT_export_migration_reports():
print("export report mkdir error:%s" % mkdir_log_pwd)
info = mod.split(',')
- scp_log = "sshpass -p %s" % password + " scp -r %s" % json_data.get('info').split("|")[0] + "@%s" % info[1] \
+ scp_log = "sshpass -p '%s'" % password + " scp -r %s" % json_data.get('info').split("|")[0] + "@%s" % info[1] \
+ ":/var/tmp/uos-migration/UOS*.tar.gz /var/uos-migration/"
try:
os.system(scp_log)
diff --git a/ut-Migration-tools/templates/MT_migration.html b/ut-Migration-tools/templates/MT_migration.html
index 39bed0b..77bf56a 100644
--- a/ut-Migration-tools/templates/MT_migration.html
+++ b/ut-Migration-tools/templates/MT_migration.html
@@ -65,7 +65,8 @@
<script>
$(document).ready(function() {
- progress = setInterval("check_progress()",2000);
+ progress = setInterval("check_progress()",2000);
+ log_info = setInterval("migration_details()",2000);
setInterval("system_migration()",36000);
});
diff --git a/ut-Migration-tools/views/migration.py b/ut-Migration-tools/views/migration.py
index 33c4b19..2e9c0c5 100644
--- a/ut-Migration-tools/views/migration.py
+++ b/ut-Migration-tools/views/migration.py
@@ -38,6 +38,10 @@ def close_tool(data):
def check_user(data):
services = check_services(data, '/check_user')
if services:
+ json_data = json.loads(data)
+ with open('/usr/lib/migration-tools-server/.passwd.txt','w',encoding='utf-8') as f:
+ text = json_data['passwd']
+ f.write(text)
return services
def check_repo(data):
@@ -85,4 +89,4 @@ def system_migration(data):
def migration_details(data):
services = check_services(data, '/migration_details')
if services:
- return services
\ No newline at end of file
+ return services
--
2.41.0

View File

@ -1,29 +1,35 @@
Name: migration-tools
Version: 1.0.0
Release: 1
License: MulanPSL-2.0
Release: 2
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
License: MulanPSL-2.0
Source0: ut-Migration-tools.tar.gz
Patch0: 0001-fix-export-error-and-no-migration-details-issue.patch
BuildArch: noarch
%description
UOS Migration Software
%package -n migration-tools-server
Summary: migration-tools-server
License: MulanPSL-2.0
Requires: python3
Requires: python3-pip
Requires: sshpass
Requires: python3-paramiko
Requires: python3-flask
Requires: python3-requests
Summary: migration-tools-server
License: MulanPSL-2.0
Requires:python3
Requires:python3-pip
Requires:sshpass
Requires:python3-paramiko
Requires:python3-flask
Requires:python3-requests
%description -n migration-tools-server
Migration software server side
%prep
%setup -c
%patch 0 -p1
%install
rm -rf %{buildroot}
@ -31,6 +37,7 @@ mkdir -p $RPM_BUILD_ROOT/usr/lib/migration-tools-server
mkdir -p $RPM_BUILD_ROOT/var/tmp/uos-migration
%{__mkdir_p} $RPM_BUILD_ROOT/etc/migration-tools
cp -r ut-Migration-tools/* $RPM_BUILD_ROOT/usr/lib/migration-tools-server/
# Install server config
@ -53,6 +60,7 @@ systemctl disable migration-tools-server.service
rm -rf /usr/lib/migration-tools-server/
rm -rf /usr/lib/migration-tools
rm -rf /usr/bin/migration-tools
rm -rf /usr/lib/systemd/system/migration-tools-server.service
%files -n migration-tools-server
@ -61,5 +69,9 @@ rm -rf /usr/bin/migration-tools
%changelog
* Mon Aug 21 2023 lixin <lixinb@uniontech.com> - 1.0.0-2
- fix export log and migration report error
- fix no migration detail error
* Wed Aug 16 2023 lixin <lixinb@uniontech.com> - 1.0.0-1
- init

Binary file not shown.