!95 get initial os_verion from agent_info infterface

From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
This commit is contained in:
openeuler-ci-bot 2024-11-06 02:09:31 +00:00 committed by Gitee
commit b1feb51944
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From 8dbb02f7ffc89e6e5f3a634dac500b197028124d Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Fri, 10 Nov 2023 14:24:51 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=8Eagent=5Finfo=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=B3=BB=E7=BB=9F=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/migration.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py
index 6dddb7b..ebee24d 100644
--- a/sysmig_agent/migration.py
+++ b/sysmig_agent/migration.py
@@ -210,3 +210,14 @@ def get_mig_state(task_id):
return str(state)
except:
return None
+
+
+def get_old_osnameversion():
+ sql = "SELECT agent_os FROM agent_info WHERE agent_ip = '{}' ;".format(get_local_ip())
+ ret_sql_msg_info = DBHelper().execute(sql)
+ try:
+ state = ret_sql_msg_info.fetchall()[0][0]
+ if len(state):
+ return str(state)
+ except:
+ return None
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 41
Release: 42
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
@ -48,7 +48,7 @@ Patch38: 0038-obtain-kernel-data.patch
Patch39: 0039-repository-file-choose-kernel-version-to-migration.patch
Patch40: 0040-intial-logfile-and-tmpfile.patch
Patch41: 0041-get-migration-status-from-database.patch
Patch42: 0042-get-initial-os-version-from-agent_info-interface.patch
BuildArch: noarch
BuildRequires: systemd
@ -147,6 +147,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-42
- 0042-get-initial-os-version-from-agent_info-interface.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-41
- 0041-get-migration-status-from-database.patch