Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复主机信息未更新成功导致沿用旧Agent-ID问题 (closed #2451) #2464

Open
wants to merge 1 commit into
base: v2.4.8-dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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