!83 system information import into the database after migration
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
d1c522d9e0
@ -0,0 +1,57 @@
|
||||
From 88d87089720784e3dd57b1f780e5ecc398ed03be Mon Sep 17 00:00:00 2001
|
||||
From: xuezhixin <xuezhixin@uniontech.com>
|
||||
Date: Fri, 10 Nov 2023 11:20:58 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=90=8E=E7=B3=BB=E7=BB=9F?=
|
||||
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AF=BC=E5=85=A5=E6=95=B0=E6=8D=AE=E5=BA=93?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
sysmig_agent/share.py | 33 +++++++++++++++++++++++++++++++++
|
||||
1 file changed, 33 insertions(+)
|
||||
|
||||
diff --git a/sysmig_agent/share.py b/sysmig_agent/share.py
|
||||
index 1a12a7e..6b8da14 100644
|
||||
--- a/sysmig_agent/share.py
|
||||
+++ b/sysmig_agent/share.py
|
||||
@@ -368,3 +368,36 @@ def main_conf(osname):
|
||||
|
||||
logger.info("Switch complete.UniontechOS recommends rebooting this system.")
|
||||
return 0
|
||||
+
|
||||
+
|
||||
+def sql_os_newversion(localos):
|
||||
+ sql = "UPDATE agent_info SET agent_migration_os = '{}' WHERE agent_ip = '{}';".format(localos, get_local_ip())
|
||||
+ try:
|
||||
+ ret = DBHelper().execute(sql)
|
||||
+ except:
|
||||
+ pass
|
||||
+
|
||||
+
|
||||
+def get_new_osversion():
|
||||
+ new_os = '统信服务器操作系统V20({})'
|
||||
+ path = '/etc/os-version'
|
||||
+ if os.path.exists(path):
|
||||
+ with open(path,'r') as v:
|
||||
+ ret = v.readlines()
|
||||
+ localos=ostype=''
|
||||
+ for i in range(len(ret)):
|
||||
+ if not ret[i]:
|
||||
+ continue
|
||||
+ if 'MinorVersion' in ret[i]:
|
||||
+ strminor = str(ret[i])
|
||||
+ _, localos = strminor.split('=',1)
|
||||
+ if 'EditionName[zh_CN]' in ret[i]:
|
||||
+ strminor = str(ret[i])
|
||||
+ _, ostype = strminor.split('=',1)
|
||||
+ ostype = re.sub('[^a-zA-Z]+','',ostype)
|
||||
+ localos = localos.strip().strip('\n') + ostype.strip().strip('\n')
|
||||
+ localos = new_os.format(localos.strip().strip('\n'))
|
||||
+ sql_os_newversion(localos)
|
||||
+
|
||||
+ else:
|
||||
+ sql_os_newversion('NULL')
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 29
|
||||
Release: 30
|
||||
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
|
||||
@ -36,6 +36,9 @@ Patch26: 0026-create-repository-and-disable-local-repofile.patch
|
||||
Patch27: 0027-fix-grub-file-for-system-option.patch
|
||||
Patch28: 0028-send-agent-task.patch
|
||||
Patch29: 0029-json-and-list-format-interchange.patch
|
||||
Patch30: 0030-system-information-import-info-the-database-after-migration.patch
|
||||
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: systemd
|
||||
%description
|
||||
@ -133,6 +136,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-30
|
||||
- 0030-system-information-import-info-the-database-after-migration.patch
|
||||
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-29
|
||||
- 0029-json-and-list-format-interchange.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user