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

