From 3aaae0d2ef3beded1a05d652b22eef5d1f4510fd Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Tue, 5 Nov 2024 15:55:39 +0800 Subject: [PATCH] add url processing function --- 0024-add-url-processing-function.patch | 48 ++++++++++++++++++++++++++ migration-tools.spec | 7 +++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 0024-add-url-processing-function.patch diff --git a/0024-add-url-processing-function.patch b/0024-add-url-processing-function.patch new file mode 100644 index 0000000..3ff5811 --- /dev/null +++ b/0024-add-url-processing-function.patch @@ -0,0 +1,48 @@ +From b627e1aecff4edd096c4ce6cc04486adc04fe89e Mon Sep 17 00:00:00 2001 +From: lixin +Date: Fri, 10 Nov 2023 10:44:12 +0800 +Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0url=E5=A4=84=E7=90=86?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + interaction.py | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + create mode 100644 interaction.py + +diff --git a/interaction.py b/interaction.py +new file mode 100644 +index 0000000..e4016ab +--- /dev/null ++++ b/interaction.py +@@ -0,0 +1,25 @@ ++import requests ++import json ++from sysmig_agent.share import getSysMigConf ++ ++headers = {'content-type': 'application/json'} ++ ++class Interaction: ++ def __init__(self, url, data): ++ self.url = url ++ self.data = data ++ ++ def send_post_requests(self): ++ try: ++ r = requests.post(url=self.url, data=self.data, headers=headers, timeout=10) ++ except: ++ r = None ++ return r ++ ++ ++def splice_url(data, url, ip): ++ uos_sysmig_conf = json.loads(getSysMigConf(ip)) ++ port = json.loads(uos_sysmig_conf).get('agentport').strip()[1:-1] ++ post_url = "http://" + ip + ":" + port + url ++ data = Interaction(post_url, data) ++ return data.send_post_requests() +\ No newline at end of file +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index 9de0b3f..ce7386f 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 23 +Release: 24 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 @@ -30,6 +30,8 @@ Patch20: 0020-get-task-process-and-migration-stage-information.patch Patch21: 0021-get-agent-ip-interface.patch Patch22: 0022-udpate-agent-host-status-online.patch Patch23: 0023-update-the-status-of-the-migration-phase.patch +Patch24: 0024-add-url-processing-function.patch + BuildArch: noarch BuildRequires: systemd @@ -128,6 +130,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Tue Nov 5 2024 xuezhixin - 1.0.2-24 +- 0024-add-url-processing-function.patch + * Mon Nov 4 2024 xuezhixin - 1.0.2-23 - 0023-update-the-status-of-the-migration-phase.patch -- Gitee