!54 update to 1.0.2
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
56bd196841
119
0001-format-code.patch
Normal file
119
0001-format-code.patch
Normal file
@ -0,0 +1,119 @@
|
||||
From 8dbd8088e6895367eb09f3a01389a6ebe3ce9feb Mon Sep 17 00:00:00 2001
|
||||
From: FanSheng Meng <mengfansheng@uniontech.com>
|
||||
Date: Mon, 16 Oct 2023 14:07:46 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BB=A3=E7=A0=81=E6=A0=BC?=
|
||||
=?UTF-8?q?=E5=BC=8F?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
.../centos7/openeuler/centos72openeuler.py | 6 ++----
|
||||
views/migration.py | 11 +++++++----
|
||||
2 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py b/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||
index 05a444c..7ccdb44 100644
|
||||
--- a/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||
+++ b/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||
@@ -28,7 +28,6 @@ def run_subprocess(cmd):
|
||||
print(output) # Print the output to console
|
||||
return output, process.returncode
|
||||
except subprocess.CalledProcessError as e:
|
||||
- #print(f"Command '{e.cmd}' failed with return code {e.returncode}.")
|
||||
print(e.stderr) # Print the error output to console
|
||||
return e.stderr, e.returncode
|
||||
|
||||
@@ -87,6 +86,7 @@ def add_boot_option():
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
+
|
||||
def swap_release(release):
|
||||
tmp_dir = '/var/tmp'
|
||||
rpme_release = 'rpm -qf /etc/os-release | xargs -i rpm -e --nodeps {}'
|
||||
@@ -163,6 +163,7 @@ def system_sync():
|
||||
return False
|
||||
return True
|
||||
|
||||
+
|
||||
def main():
|
||||
if not check_pkg("yum-utils"):
|
||||
print("please install yum-utils")
|
||||
@@ -187,7 +188,6 @@ def main():
|
||||
with open(repofile, 'w') as f:
|
||||
f.write(openeuler_repo)
|
||||
|
||||
-
|
||||
openEuler_release = 'openEuler-release'
|
||||
if not check_pkg(openEuler_release):
|
||||
print("swaping release")
|
||||
@@ -240,7 +240,6 @@ def main():
|
||||
print("Removing confilct package yum...")
|
||||
system_sync()
|
||||
|
||||
-
|
||||
# boot cui
|
||||
print("set boot target to cui")
|
||||
cmd = 'systemctl set-default multi-user.target'
|
||||
@@ -263,6 +262,5 @@ def main():
|
||||
os.system("reboot")
|
||||
|
||||
|
||||
-
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
diff --git a/views/migration.py b/views/migration.py
|
||||
index 1312d33..477627b 100644
|
||||
--- a/views/migration.py
|
||||
+++ b/views/migration.py
|
||||
@@ -1,12 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
||||
# SPDX-License-Identifier: MulanPubL-2.0-or-later
|
||||
-
|
||||
-from flask import *
|
||||
import os
|
||||
-
|
||||
+from flask import *
|
||||
from client_requests import *
|
||||
from func.utils import *
|
||||
|
||||
+
|
||||
def check_services(data, url):
|
||||
info = post_client_data(data, url)
|
||||
if info is None or info.status_code != 200:
|
||||
@@ -27,26 +26,30 @@ def check_os(data):
|
||||
if services:
|
||||
return services
|
||||
|
||||
+
|
||||
def check_storage(data):
|
||||
services = check_services(data, '/check_storage')
|
||||
if services:
|
||||
return services
|
||||
|
||||
+
|
||||
def close_tool(data):
|
||||
os.system('kill -9 `ps -ef | grep "start_webview.py" | grep -v grep | awk \'{print $2}\'`')
|
||||
data = {"ip": "0.0.0.0"}
|
||||
data_json = json.dumps(data)
|
||||
return data_json
|
||||
|
||||
+
|
||||
def check_user(data):
|
||||
services = check_services(data, '/check_user')
|
||||
if services:
|
||||
json_data = json.loads(data)
|
||||
- with open('/usr/lib/migration-tools-server/.passwd.txt','w',encoding='utf-8') as f:
|
||||
+ with open('/usr/lib/migration-tools-server/.passwd.txt', 'w', encoding='utf-8') as f:
|
||||
text = json_data['passwd']
|
||||
f.write(text)
|
||||
return services
|
||||
|
||||
+
|
||||
def check_repo(data):
|
||||
services = check_services(data, '/check_repo')
|
||||
if services:
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
From 192fd69de19a78afe81a5a2c5a8270057f12ee3d Mon Sep 17 00:00:00 2001
|
||||
From: lixin <lixinb@uniontech.com>
|
||||
Date: Mon, 18 Mar 2024 10:32:17 +0800
|
||||
Subject: [PATCH] use kill instead of kill-INT
|
||||
|
||||
---
|
||||
server/migration-tools-server.service | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/migration-tools-server.service b/server/migration-tools-server.service
|
||||
index 8cd53a3..dd16c95 100644
|
||||
--- a/server/migration-tools-server.service
|
||||
+++ b/server/migration-tools-server.service
|
||||
@@ -5,7 +5,7 @@ After=network-online.target
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python3 /usr/lib/migration-tools-server/index.py
|
||||
-ExecStop=/bin/kill-INT $MAINPID
|
||||
+ExecStop=/bin/kill -HUP $MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
From 52c434875d1cda64d0abd96e115001ffef0d2cc5 Mon Sep 17 00:00:00 2001
|
||||
From: lixin <lixinb@uniontech.com>
|
||||
Date: Mon, 1 Apr 2024 11:04:00 +0800
|
||||
Subject: [PATCH] modify-description
|
||||
|
||||
---
|
||||
templates/MT_agreement.html | 2 +-
|
||||
templates/MT_migration_results.html | 2 +-
|
||||
templates/MT_note.html | 12 +++++++-----
|
||||
3 files changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/templates/MT_agreement.html b/templates/MT_agreement.html
|
||||
index be70ca8..d15a399 100755
|
||||
--- a/templates/MT_agreement.html
|
||||
+++ b/templates/MT_agreement.html
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="header">
|
||||
<i class="rocket icon"></i> 欢迎使用统信服务器系统迁移软件。
|
||||
</div>
|
||||
- 此迁移工具用于将【当前操作系统】替换为【统信服务器操作系统 V20】,并将 RPM 软件包替换为统信的 RPM 软件包。
|
||||
+ 此迁移工具用于将【当前操作系统】替换为【openEuler-20.03-LTS-SP1或统信服务器操作系统】,并将 RPM 软件包替换为统信的 RPM 软件包。
|
||||
</div>
|
||||
<b>协议许可:</b>
|
||||
<div class="pr-agreement">
|
||||
diff --git a/templates/MT_migration_results.html b/templates/MT_migration_results.html
|
||||
index 3ff802b..fef5292 100755
|
||||
--- a/templates/MT_migration_results.html
|
||||
+++ b/templates/MT_migration_results.html
|
||||
@@ -35,6 +35,7 @@
|
||||
<br/>
|
||||
<div align="center" >
|
||||
<label style="font-size:15px;font-family:”思源黑体”;font-weight:bold;">系统迁移已完成,请您导出迁移分析报告后手动重启服务器。</label>
|
||||
+ <p>注意:(openEuler系统迁移暂不支持导出日志/报告功能)</p>
|
||||
</div>
|
||||
<br/>
|
||||
<br/>
|
||||
@@ -88,7 +89,6 @@
|
||||
<hr style="opacity: 0.1;border: 1px solid #4C4D4E;width:99%;" />
|
||||
</br>
|
||||
</br>
|
||||
- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>完成</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
diff --git a/templates/MT_note.html b/templates/MT_note.html
|
||||
index 099523b..1a79009 100755
|
||||
--- a/templates/MT_note.html
|
||||
+++ b/templates/MT_note.html
|
||||
@@ -33,11 +33,13 @@
|
||||
</br>
|
||||
<p>1. 迁移一旦开始,过程不可逆。请确保您已将系统的数据与设置进行【完整备份】。</p>
|
||||
<p>2. 迁移前请获得管理员许可,再进行迁移工作。</p>
|
||||
- <p>3. 请提前获取【统信服务器操作系统 V20 】的软件仓库地址。</p>
|
||||
- <p>4. 迁移过程中请保证稳定的网络连接。</p>
|
||||
- <p>5. 迁移过程中请不要进行任何操作。</p>
|
||||
- <p>6. 该迁移工具目前仅支持 CentOS 7 / CentOS 8 操作系统。</p>
|
||||
- <p>7. 请确保在 '/var/cache' 中至少有 10GB 的可用空间。</p>
|
||||
+ <p>3. openEuler系统迁移目前仅支持centos7.4-7.6 cui迁移至openEuler-20.03-LTS-SP1</p>
|
||||
+ <p>3. openEuler系统迁移无需填写软件源</p>
|
||||
+ <p>4. 如需迁移UOS系统,请提前准备【统信服务器操作系统 V20 】的软件仓库地址。</p>
|
||||
+ <p>5. 迁移过程中请保证稳定的网络连接。</p>
|
||||
+ <p>6. 迁移过程中请不要进行任何操作。</p>
|
||||
+ <p>7. 该迁移工具目前仅支持 CentOS 7 / CentOS 8 操作系统。</p>
|
||||
+ <p>8. 请确保在 '/var/cache' 中至少有 10GB 的可用空间。</p>
|
||||
</br>
|
||||
</br>
|
||||
</br>
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
From ae5f25582a87a84cbc33914c27ab66e358ca271f Mon Sep 17 00:00:00 2001
|
||||
From: lixin <lixinb@uniontech.com>
|
||||
Date: Tue, 2 Apr 2024 17:13:01 +0800
|
||||
Subject: [PATCH] adjust the display sequence
|
||||
|
||||
---
|
||||
templates/MT_check_root.html | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/templates/MT_check_root.html b/templates/MT_check_root.html
|
||||
index eb4dc3f..cb5d346 100755
|
||||
--- a/templates/MT_check_root.html
|
||||
+++ b/templates/MT_check_root.html
|
||||
@@ -55,8 +55,8 @@
|
||||
<label>目标系统:</label>
|
||||
<div class="ui small left icon input">
|
||||
<select id="pending_migration" name="pending">
|
||||
- <option value="uos">uos</option>
|
||||
<option value="euler">euler</option>
|
||||
+ <option value="uos">uos</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,155 +0,0 @@
|
||||
From 0878a6820be950685d5c79abe8a655b2734b4534 Mon Sep 17 00:00:00 2001
|
||||
From: lihaipeng <lihaipeng@uniontech.com>
|
||||
Date: Tue, 27 Aug 2024 15:27:38 +0800
|
||||
Subject: [PATCH 2/2] fix-cancel-button-function-in-tool
|
||||
|
||||
---
|
||||
templates/MT_agreement.html | 6 +++---
|
||||
templates/MT_check_evn.html | 8 ++++----
|
||||
templates/MT_check_root.html | 4 ++--
|
||||
templates/MT_kernel.html | 4 ++--
|
||||
templates/MT_note.html | 4 ++--
|
||||
templates/MT_repo.html | 4 ++--
|
||||
6 files changed, 15 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/templates/MT_agreement.html b/templates/MT_agreement.html
|
||||
index d15a399..40150bf 100755
|
||||
--- a/templates/MT_agreement.html
|
||||
+++ b/templates/MT_agreement.html
|
||||
@@ -86,7 +86,7 @@
|
||||
<div class="menter_btn_a_lf">
|
||||
<br/>
|
||||
<input name="readpact" type="checkbox" id="readpact" value="" class="check_boxId" /><label for="readpact"><strong class="fc-690 fs-14" data-locale="Consent_Agreements">我已经阅读并同意此协议</strong></label>
|
||||
- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>取消</button>
|
||||
+ <!--- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>取消</button> --->
|
||||
<a href="javascript:return false;" id="paymentId" data-locale="Next_Step" type="button" class="menter_btn_a_a_lf" name="" style="text-align: center; line-height: 37px; color:black; font-size:18px; opacity: 0.2"><style>a{TEXT-DECORATION:none}</style>下一步</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,8 +119,8 @@
|
||||
});
|
||||
|
||||
function close_tool() {
|
||||
- alert("确定关闭迁移软件吗?")
|
||||
- }
|
||||
+ alert("确定关闭迁移软件吗?")
|
||||
+ }
|
||||
|
||||
</script>
|
||||
</body>
|
||||
diff --git a/templates/MT_check_evn.html b/templates/MT_check_evn.html
|
||||
index fe9c8d8..47b2029 100755
|
||||
--- a/templates/MT_check_evn.html
|
||||
+++ b/templates/MT_check_evn.html
|
||||
@@ -52,7 +52,7 @@
|
||||
<hr style="opacity: 0.1;border: 1px solid #4C4D4E;width:99%;" />
|
||||
</br>
|
||||
</br>
|
||||
- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>取消</button>
|
||||
+ <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>上一步</button>
|
||||
<button id="check_id" onclick="save()" type="submit" class="menter_btn_a_a_lf" name="" style="text-align: center; line-height: 37px; color:black; font-size:18px;opacity: 0.2;" disabled = "disabled"><style>a{TEXT-DECORATION:none}</style>下一步</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -131,9 +131,9 @@
|
||||
window.location.href="MT_check_user"
|
||||
}
|
||||
|
||||
- function close_tool() {
|
||||
- alert("确定关闭迁移软件吗?");
|
||||
- }
|
||||
+ function close_tool() {
|
||||
+ window.location.href="MT_note"
|
||||
+ }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
diff --git a/templates/MT_check_root.html b/templates/MT_check_root.html
|
||||
index cb5d346..5e4ce52 100755
|
||||
--- a/templates/MT_check_root.html
|
||||
+++ b/templates/MT_check_root.html
|
||||
@@ -72,7 +72,7 @@
|
||||
<hr style="opacity: 0.1;border: 1px solid #4C4D4E;width:99%;" />
|
||||
</br>
|
||||
</br>
|
||||
- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>取消</button>
|
||||
+ <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>上一步</button>
|
||||
<button id="check_id" disabled="disabled" data-locale="Next_Step" type="submit" class="menter_btn_a_a_lf" name="" style="text-align: center; line-height: 37px; color:black; font-size:18px;opacity: 0.2" onclick="save()"><style>a{TEXT-DECORATION:none}</style>下一步</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
function close_tool() {
|
||||
- alert("确定关闭迁移软件吗?");
|
||||
+ window.location.href="MT_check_env"
|
||||
}
|
||||
|
||||
$("#uname_id").bind("input propertychange",function(event){
|
||||
diff --git a/templates/MT_kernel.html b/templates/MT_kernel.html
|
||||
index e8b93c8..9553bc6 100755
|
||||
--- a/templates/MT_kernel.html
|
||||
+++ b/templates/MT_kernel.html
|
||||
@@ -53,7 +53,7 @@
|
||||
<hr style="opacity: 0.1;border: 1px solid #4C4D4E;width:99%;" />
|
||||
</br>
|
||||
</br>
|
||||
- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>取消</button>
|
||||
+ <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>上一步</button>
|
||||
<button id="check_note" type="submit" class="menter_btn_a_a_lf" name="" style="text-align: center; line-height: 37px; color:black; font-size:18px;opacity: 1" onclick="save()"><style>a{TEXT-DECORATION:none}</style>下一步</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
|
||||
function close_tool() {
|
||||
- alert("确定关闭迁移软件吗?");
|
||||
+ window.location.href="MT_repo"
|
||||
}
|
||||
|
||||
</script>
|
||||
diff --git a/templates/MT_note.html b/templates/MT_note.html
|
||||
index 1a79009..2da1294 100755
|
||||
--- a/templates/MT_note.html
|
||||
+++ b/templates/MT_note.html
|
||||
@@ -48,7 +48,7 @@
|
||||
<hr style="opacity: 0.1;border: 1px solid #4C4D4E;width:99%;" />
|
||||
</br>
|
||||
</br>
|
||||
- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>取消</button>
|
||||
+ <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>上一步</button>
|
||||
<button id="check_note" data-locale="Next_Step" type="submit" class="menter_btn_a_a_lf" name="" style="text-align: center; line-height: 37px; color:black; font-size:18px;opacity: 1" onclick="save()"><style>a{TEXT-DECORATION:none}</style>下一步</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,7 +75,7 @@
|
||||
}
|
||||
|
||||
function close_tool() {
|
||||
- alert("确定关闭迁移软件吗?");
|
||||
+ window.location = '/MT_agreement';
|
||||
}
|
||||
|
||||
</script>
|
||||
diff --git a/templates/MT_repo.html b/templates/MT_repo.html
|
||||
index 2c145af..c5fa384 100755
|
||||
--- a/templates/MT_repo.html
|
||||
+++ b/templates/MT_repo.html
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="menter_btn_a_lf" >
|
||||
<hr style="opacity: 0.1;border: 1px solid #4C4D4E;width:99%;" />
|
||||
</br>
|
||||
- <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>取消</button>
|
||||
+ <button onclick="close_tool();" data-toggle="modal" data-target="#exampleModal" type="submit" class="menter_btn_a_a_lf" data-locale="Exit" style="text-align: center; line-height: 37px; color:black; font-size:18px;"><style>a{TEXT-DECORATION:none}</style>上一步</button>
|
||||
<button id="check_repo" disabled="disabled" data-locale="Next_Step" type="submit" class="menter_btn_a_a_lf" name="" style="text-align: center; line-height: 37px; color:black; font-size:18px;opacity: 0.2" onclick="save()"><style>a{TEXT-DECORATION:none}</style>下一步</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
|
||||
function close_tool() {
|
||||
- alert("确定关闭迁移软件吗");
|
||||
+ window.location.href="MT_check_user"
|
||||
}
|
||||
|
||||
$("#repo_pwd").bind("input propertychange",function(event){
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,85 +0,0 @@
|
||||
From 27f65f5c5e38b6d0cee28db3591784266a47de9e Mon Sep 17 00:00:00 2001
|
||||
From: lixin <lixinb@uniontech.com>
|
||||
Date: Tue, 12 Mar 2024 10:42:07 +0800
|
||||
Subject: [PATCH] CVE-2024-24892
|
||||
|
||||
---
|
||||
index.py | 50 ++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 32 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/index.py b/index.py
|
||||
index 239148e..f604fc2 100644
|
||||
--- a/index.py
|
||||
+++ b/index.py
|
||||
@@ -4,6 +4,7 @@
|
||||
# SPDX-License-Identifier: MulanPubL-2.0-or-later
|
||||
import os
|
||||
import json
|
||||
+import paramiko
|
||||
from func import share
|
||||
from urls import server_mods
|
||||
from flask import Flask, render_template, request, Response
|
||||
@@ -202,29 +203,42 @@ def export_migration_reports():
|
||||
:return:
|
||||
"""
|
||||
mod = check_methods()
|
||||
- f = open("/usr/lib/migration-tools-server/.passwd.txt", "r")
|
||||
- password = f.read()
|
||||
- f.close()
|
||||
if mod:
|
||||
data = request.get_data()
|
||||
json_data = json.loads(data)
|
||||
- mkdir_log_pwd = "/var/uos-migration/"
|
||||
- isExists=os.path.exists(mkdir_log_pwd)
|
||||
- if not isExists:
|
||||
- try:
|
||||
- os.makedirs(mkdir_log_pwd)
|
||||
- print(mkdir_log_pwd)
|
||||
- except:
|
||||
- print("export report mkdir error:%s" % mkdir_log_pwd)
|
||||
-
|
||||
+ user = json_data.get('info').split("|")[0]
|
||||
info = mod.split(',')
|
||||
- scp_log = "sshpass -p '%s'" % password + " scp -r %s" % json_data.get('info').split("|")[0] + "@%s" % info[1] \
|
||||
- + ":/var/tmp/uos-migration/UOS*.tar.gz /var/uos-migration/"
|
||||
+ ip = info[1].strip('"')
|
||||
+ port = 22
|
||||
+
|
||||
+ with open("/usr/lib/migration-tools-server/.passwd.txt", "r") as f:
|
||||
+ password = f.read()
|
||||
+
|
||||
+ remote_dir = local_dir = "/var/tmp/uos-migration"
|
||||
+ if not os.path.exists(local_dir):
|
||||
+ os.makedirs(local_dir)
|
||||
+
|
||||
+ client = paramiko.SSHClient()
|
||||
+ client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
try:
|
||||
- os.system(scp_log)
|
||||
- print(scp_log)
|
||||
- except:
|
||||
- print('export report scp error:%s' % scp_log)
|
||||
+ client.connect(ip, port, user, password)
|
||||
+ sftp = client.open_sftp()
|
||||
+
|
||||
+ remote_files = sftp.listdir(remote_dir)
|
||||
+ # 遍历远程文件列表
|
||||
+ for filename in remote_files:
|
||||
+ if filename.endswith('.tar.gz'):
|
||||
+ remote_file_path = os.path.join(remote_dir, filename)
|
||||
+ local_file_path = os.path.join(local_dir, filename)
|
||||
+ sftp.get(remote_file_path, local_file_path)
|
||||
+
|
||||
+ except Exception as e:
|
||||
+ print(f"Error: {e}")
|
||||
+
|
||||
+ finally:
|
||||
+ # 关闭连接
|
||||
+ if client:
|
||||
+ client.close()
|
||||
return Response(mod, content_type='application/json')
|
||||
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@ -1,19 +1,13 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.1
|
||||
Release: 7
|
||||
Version: 1.0.2
|
||||
Release: 1
|
||||
License: MulanPSL-2.0
|
||||
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
||||
Source0: migration-tools.tar.gz
|
||||
Source1: requires.tar.gz
|
||||
Source2: xlwt-1.3.0-py2.py3-none-any.whl
|
||||
# patches
|
||||
Patch0: 0001-use-kill-not-kill-INT-when-stop-service.patch
|
||||
Patch1: 0002-modify-description.patch
|
||||
Patch2: 0003-adjust-the-display-sequence.patch
|
||||
Patch3: 0004-fix-cancel-button-function-in-tool.patch
|
||||
|
||||
# CVE patches: >= 100
|
||||
Patch100: 100-CVE-2024-24892.patch
|
||||
Patch0: 0001-format-code.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: systemd
|
||||
@ -57,12 +51,9 @@ Migration software server side
|
||||
%setup -c
|
||||
|
||||
%patch 0 -p1
|
||||
%patch 1 -p1
|
||||
%patch 2 -p1
|
||||
%patch 3 -p1
|
||||
%patch 100 -p1
|
||||
|
||||
%if 0%{?openEuler}
|
||||
mkdir agent-requires
|
||||
cp -f %SOURCE1 agent-requires/
|
||||
cp -f %SOURCE2 agent-requires/
|
||||
%endif
|
||||
@ -83,7 +74,7 @@ cp -r * $RPM_BUILD_ROOT/usr/lib/migration-tools-agent/
|
||||
%endif
|
||||
|
||||
# Install server config
|
||||
%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools.conf $RPM_BUILD_ROOT/etc/migration-tools
|
||||
%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/uos-sysmig.conf $RPM_BUILD_ROOT/etc/migration-tools
|
||||
%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools-server.service $RPM_BUILD_ROOT%{_unitdir}
|
||||
|
||||
%posttrans
|
||||
@ -115,6 +106,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Oct 31 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-1
|
||||
- add 0001-stander-code.patch
|
||||
|
||||
* Tue Aug 27 2024 lihaipeng <lihaipeng@uniontech.com> - 1.0.1-7
|
||||
- fix cancel button function in tool
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user