From 5a958f913996defb76774d2aa6e015cb4e8026f9 Mon Sep 17 00:00:00 2001 From: dcd <1151627903@qq.com> Date: Fri, 18 Oct 2024 21:46:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9C=AA=E6=9B=B4=E6=96=B0=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=B2=BF=E7=94=A8=E6=97=A7Agent-ID=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(closed=20#2451)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/backend/components/collections/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/backend/components/collections/plugin.py b/apps/backend/components/collections/plugin.py index d87312bd2..1cb9f5db3 100644 --- a/apps/backend/components/collections/plugin.py +++ b/apps/backend/components/collections/plugin.py @@ -1194,6 +1194,8 @@ def _execute(self, data, parent_data, common_data: PluginCommonData): meta_name = self.get_plugin_meta_name(plugin, process_status) gse_control = self.get_gse_control(host.os_type, package_control, process_status) + # 优先使用instance_info里的最新的Agent-ID,host里的Agent-ID可能为旧的 + bk_agent_id: str = subscription_instance.instance_info["host"].get("bk_agent_id") or host.bk_agent_id gse_op_params = { "meta": {"namespace": constants.GSE_NAMESPACE, "name": meta_name}, @@ -1203,7 +1205,7 @@ def _execute(self, data, parent_data, common_data: PluginCommonData): "process_status_id": process_status.id, "subscription_instance_id": subscription_instance.id, }, - "hosts": [{"ip": host.inner_ip, "bk_agent_id": host.bk_agent_id, "bk_cloud_id": host.bk_cloud_id}], + "hosts": [{"ip": host.inner_ip, "bk_agent_id": bk_agent_id, "bk_cloud_id": host.bk_cloud_id}], "spec": { "identity": { "index_key": "",