Skip to content

Commit

Permalink
fix: bk_agent_id不存在(agent1.0)的情况下可以使用bk_cloud_id和bk_host_innerip来兼容查询
Browse files Browse the repository at this point in the history
  • Loading branch information
Myfatguy11 authored and zhangzhw8 committed Sep 7, 2023
1 parent 84649fe commit 40c18ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dbm-ui/backend/db_services/ipchooser/query/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ def query_agent_two_status(cc_hosts, fill_key="status"):
index = 0
agent_id_list, host_map = [], {}
for cc_host in cc_hosts:
bk_agent_id = cc_host["bk_agent_id"]
# bk_agent_id不存在(agent1.0)的情况下可以使用bk_cloud_id和bk_host_innerip来兼容查询
bk_agent_id = cc_host.get("bk_agent_id") or f'{cc_host["bk_cloud_id"]}:{cc_host["bk_host_innerip"]}'
agent_id_list.append(bk_agent_id)
host_map[bk_agent_id] = index
index += 1
Expand Down

0 comments on commit 40c18ff

Please sign in to comment.