!69 get local ip on the agent
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
c3f243389e
41
0016-get-local-ip-on-the-agent.patch
Normal file
41
0016-get-local-ip-on-the-agent.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 36a4d4629cef2cf5df278fd2ca503b6b84a89751 Mon Sep 17 00:00:00 2001
|
||||
From: xuezhixin <xuezhixin@uniontech.com>
|
||||
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
|
||||
|
||||
@ -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 <xuezhixin@uniontech.com> - 1.0.2-16
|
||||
- 0016-get-local-ip-on-the-agent.patch
|
||||
|
||||
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-15
|
||||
- 0015-delete-host-information-interface.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user