Skip to content

Commit

Permalink
fix: 修复主机信息未更新成功导致沿用旧Agent-ID问题 (closed TencentBlueKing#2451)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huayeaaa authored and wyyalt committed Nov 21, 2024
1 parent 1305056 commit ce731fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/backend/components/collections/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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": "",
Expand Down

0 comments on commit ce731fc

Please sign in to comment.