fill in the data in the checked tempate

This commit is contained in:
xuezhixin 2024-11-07 20:15:03 +08:00
parent c7bb32e381
commit 0fb568a436
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 02efd99c88ae7ff70f757ed975a75aa4210f380f Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 14:23:24 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=A3=80=E6=B5=8B=E6=A8=A1=E6=9D=BF?=
=?UTF-8?q?=E5=A1=AB=E5=85=85=E5=BD=93=E5=89=8D=E5=B7=B2=E6=9C=89=E7=9A=84?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/Abisystmcompchk.py | 34 +++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
index cf34c87..bf32e49 100644
--- a/sysmig_agent/Abisystmcompchk.py
+++ b/sysmig_agent/Abisystmcompchk.py
@@ -642,3 +642,37 @@ def mycopyfile(srcfile, dstfile, logger):
return dstfile
+
+#Generate report name
+def create_migrate_report_name(flag, logg):
+
+ migrate_before_report_path = '/var/tmp/uos-migration/UOS_analysis_report/'
+ migrate_behind_report_path = '/var/tmp/uos-migration/UOS_migration_completed_report/'
+
+ migrate_report_before_sample_name = 'UOS_migration_report_HOSTIP_HOSTNAME_YYYYMMDDHHMM-BEFORE.xls'
+ migrate_report_behind_sample_name = 'UOS_migration_report_HOSTIP_HOSTNAME_YYYYMMDDHHMM-BEHIND.xls'
+
+ hostip = get_local_ip()
+ hostname = socket.gethostname()
+ hosttime = datetime.datetime.now().strftime('%Y%m%d%H%M')
+ abs_path = os.path.abspath('sysmig_agent/txts/')
+
+ if not os.path.exists(migrate_behind_report_path):
+ os.makedirs(migrate_behind_report_path)
+
+ #migration before
+ if flag=='0':
+ migrate_name_01 = migrate_report_before_sample_name.replace('HOSTIP', hostip)
+ migrate_name_02 = migrate_name_01.replace('HOSTNAME', hostname)
+ migrate_name = migrate_before_report_path + migrate_name_02.replace('YYYYMMDDHHMM-BEFORE', hosttime)
+ migrate_path_name_sample = abs_path + '/' + migrate_report_before_sample_name
+
+ #migration behind
+ elif flag=='1':
+ migrate_name_01 = migrate_report_behind_sample_name.replace('HOSTIP', hostip)
+ migrate_name_02 = migrate_name_01.replace('HOSTNAME', hostname)
+ migrate_name = migrate_behind_report_path + migrate_name_02.replace('YYYYMMDDHHMM-BEHIND', hosttime)
+ migrate_path_name_sample = abs_path + '/' + migrate_report_behind_sample_name
+
+ #Rename the real report name
+ return mycopyfile(migrate_path_name_sample, migrate_name, logg)
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 77
Release: 78
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
@ -84,6 +84,8 @@ Patch74: 0074-detection-basic-system-information.patch
Patch75: 0075-detection-basic-information-and-format-abi-compatibility-information-to-report.patch
Patch76: 0076-detection-storage-interface.patch
Patch77: 0077-copy-from-unzip-rpm-diractory-and-system-file-to-compatility-diractory.patch
Patch78: 0078-fill-in-the-data-in-the-checked-templace.patch
BuildArch: noarch
@ -183,6 +185,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-78
- 0078-fill-in-the-data-in-the-checked-templace.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-77
- 0077-copy-from-unzip-rpm-diractory-and-system-file-to-compatility-diractory.patch