From 40c18ff375263180b33eb334d81aaef5534cff05 Mon Sep 17 00:00:00 2001 From: gaohongsong Date: Thu, 7 Sep 2023 16:30:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20bk=5Fagent=5Fid=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8(agent1.0)=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=BD=BF=E7=94=A8bk=5Fcloud=5Fid=E5=92=8Cbk?= =?UTF-8?q?=5Fhost=5Finnerip=E6=9D=A5=E5=85=BC=E5=AE=B9=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/backend/db_services/ipchooser/query/resource.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbm-ui/backend/db_services/ipchooser/query/resource.py b/dbm-ui/backend/db_services/ipchooser/query/resource.py index a27fe88b0a..44a9dc5e62 100644 --- a/dbm-ui/backend/db_services/ipchooser/query/resource.py +++ b/dbm-ui/backend/db_services/ipchooser/query/resource.py @@ -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