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": "",