diff --git a/0016-get-local-ip-on-the-agent.patch b/0016-get-local-ip-on-the-agent.patch new file mode 100644 index 0000000000000000000000000000000000000000..eec7fcd2243e9dccd0c5b3716158729a77f190b8 --- /dev/null +++ b/0016-get-local-ip-on-the-agent.patch @@ -0,0 +1,41 @@ +From 36a4d4629cef2cf5df278fd2ca503b6b84a89751 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Fri, 10 Nov 2023 10:01:24 +0800 +Subject: [PATCH] =?UTF-8?q?agent=E8=8E=B7=E5=8F=96=E6=9C=AC=E5=9C=B0IP?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/share.py | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/sysmig_agent/share.py b/sysmig_agent/share.py +index ec9265b..ea3d63a 100644 +--- a/sysmig_agent/share.py ++++ b/sysmig_agent/share.py +@@ -7,9 +7,20 @@ import platform + import re + import shutil + import subprocess +- ++import socket + from sysmig_agent.utils import list_to_json + ++ ++def get_local_ip(): ++ try: ++ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ++ s.connect(('8.8.8.8', 80)) ++ ip = s.getsockname()[0] ++ return ip ++ finally: ++ s.close() ++ ++ + def getSysMigConf(): + confpath = '/etc/migration-tools/migration-tools.conf' + if not os.path.exists(confpath): +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index 6da77672a87580974812fa4080ebf877293d3d52..d3840b0706a5c03ec802c701eedb65d0ef4b71fc 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 15 +Release: 16 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 @@ -22,6 +22,7 @@ Patch12: 0012-add-agent_task-in-database.patch Patch13: 0013-display-agent-host-information.patch Patch14: 0014-modify-task-stream-interface.patch Patch15: 0015-delete-host-information-interface.patch +Patch16: 0016-get-local-ip-on-the-agent.patch BuildArch: noarch BuildRequires: systemd @@ -120,6 +121,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Mon Nov 4 2024 xuezhixin - 1.0.2-16 +- 0016-get-local-ip-on-the-agent.patch + * Mon Nov 4 2024 xuezhixin - 1.0.2-15 - 0015-delete-host-information-interface.patch