!99 agent sends task update request to the server
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
a041d1842d
72
0046-agent-sends-task-update-requrst-to-the-server.patch
Normal file
72
0046-agent-sends-task-update-requrst-to-the-server.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From a55f866eee6a937842777af38beee70ec1cad8e4 Mon Sep 17 00:00:00 2001
|
||||
From: xuezhixin <xuezhixin@uniontech.com>
|
||||
Date: Fri, 10 Nov 2023 14:55:44 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?agent=E5=90=91server=E5=8F=91=E9=80=81=E4=BB=BB?=
|
||||
=?UTF-8?q?=E5=8A=A1=E6=9B=B4=E6=96=B0=E8=AF=B7=E6=B1=82?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
sysmig_agent/agent_request.py | 49 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 49 insertions(+)
|
||||
create mode 100644 sysmig_agent/agent_request.py
|
||||
|
||||
diff --git a/sysmig_agent/agent_request.py b/sysmig_agent/agent_request.py
|
||||
new file mode 100644
|
||||
index 0000000..31d0cfe
|
||||
--- /dev/null
|
||||
+++ b/sysmig_agent/agent_request.py
|
||||
@@ -0,0 +1,49 @@
|
||||
+# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
||||
+# SPDX-License-Identifier: MulanPubL-2.0-or-later
|
||||
+
|
||||
+import requests
|
||||
+import json
|
||||
+from sysmig_agent.share import getSysMigConf ,json_list_to_json, sql_online_statue
|
||||
+
|
||||
+uos_sysmig_conf = json.loads(getSysMigConf())
|
||||
+ip = json.loads(uos_sysmig_conf).get('serverip').strip()[1:-1]
|
||||
+port = int(json.loads(uos_sysmig_conf).get('serverport').strip()[1:-1])
|
||||
+mod_sql = '/sql_task'
|
||||
+
|
||||
+headers = {'content-type': 'application/json'}
|
||||
+
|
||||
+
|
||||
+class PostIntranetIP:
|
||||
+ def __init__(self, url, data):
|
||||
+ self.url = url
|
||||
+ self.data = data
|
||||
+
|
||||
+ def post_intranetip(self):
|
||||
+ try:
|
||||
+ r = requests.post(url=self.url, data=self.data, headers=headers)
|
||||
+ except:
|
||||
+ r = None
|
||||
+ return r
|
||||
+
|
||||
+
|
||||
+def post_client_data(data):
|
||||
+ post_url = "http://" + ip + ":" + str(port) + mod_sql
|
||||
+ print('______>post:'+post_url+'\n____> data: '+str(data) +'ip port '+ip+str(port))
|
||||
+ post_data = PostIntranetIP(post_url, data)
|
||||
+ return post_data.post_intranetip()
|
||||
+
|
||||
+
|
||||
+def post_server(statue, task_id):
|
||||
+ keylist = ['mod','statue','task_id']
|
||||
+ valuelist = ['sql_task',statue,str(task_id)]
|
||||
+ data = json_list_to_json(keylist,valuelist)
|
||||
+
|
||||
+# data={"mod":"sql_task", "statue": "task_start", "task_id":2}
|
||||
+ t = post_client_data(data)
|
||||
+ print("requires post return code :"+str(t))
|
||||
+ f = 0
|
||||
+ if not t or t.status_code != 200:
|
||||
+ t = post_client_data(data)
|
||||
+ sql_online_statue(1, task_id)
|
||||
+ else:
|
||||
+ sql_online_statue(0, task_id)
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 45
|
||||
Release: 46
|
||||
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
|
||||
@ -52,6 +52,8 @@ Patch42: 0042-get-initial-os-version-from-agent_info-interface.patch
|
||||
Patch43: 0043-process-os-version-and-os-name.patch
|
||||
Patch44: 0044-migrate-in-myutiple-steps.patch
|
||||
Patch45: 0045-modify-repository-file.patch
|
||||
Patch46: 0046-agent-sends-task-update-requrst-to-the-server.patch
|
||||
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: systemd
|
||||
@ -150,6 +152,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-46
|
||||
- 0046-agent-sends-task-update-requrst-to-the-server.patch
|
||||
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-45
|
||||
- 0045-modify-repository-file.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user