Skip to content

Commit

Permalink
fix(backend): 修复list machine获取不到主机信息的bug TencentBlueKing#5791
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Jul 25, 2024
1 parent cd3e0bd commit 43ba0e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 1 addition & 2 deletions dbm-ui/backend/db_services/dbbase/resources/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,7 @@ def _filter_machine_hook(

# 预取host的cc信息
bk_host_ids = list(machine_queryset.values_list("bk_host_id", flat=True))
host_infos = HostHandler.check([{"bk_biz_id": bk_biz_id, "scope_type": "biz"}], [], [], bk_host_ids)
host_id_info_map = {host_info["host_id"]: host_info for host_info in host_infos}
host_id_info_map = {host["host_id"]: host for host in HostHandler.check([], [], [], bk_host_ids)}

# 将集群的查询结果序列化为集群字典信息
machine_infos: List[Dict[str, Any]] = []
Expand Down
10 changes: 2 additions & 8 deletions dbm-ui/backend/db_services/redis/toolbox/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from django.db import connection

from backend import env
from backend.db_meta.enums import InstanceRole
from backend.db_meta.enums.comm import RedisVerUpdateNodeType
from backend.db_services.dbbase.cluster.handlers import ClusterServiceHandler
Expand All @@ -38,7 +37,7 @@ def __init__(self, bk_biz_id: int):
def query_cluster_ips(
self, limit=None, offset=None, cluster_id=None, ip=None, role=None, status=None, cluster_status=None
):
"""聚合查询集群下的主机"""
"""聚合查询集群下的主机 TODO:"""

limit_sql = ""
if limit and limit > 0:
Expand Down Expand Up @@ -98,12 +97,7 @@ def query_cluster_ips(
return {"count": 0, "results": ips}

# 查询主机信息
host_id_info_map = {
host_info["host_id"]: host_info
for host_info in HostHandler.check(
[{"bk_biz_id": env.DBA_APP_BK_BIZ_ID, "scope_type": "biz"}], [], [], bk_host_ids
)
}
host_id_info_map = {host["host_id"]: host for host in HostHandler.check([], [], [], bk_host_ids)}

# 查询主从状态对
master_slave_map = RedisListRetrieveResource.query_master_slave_map(
Expand Down

0 comments on commit 43ba0e7

Please sign in to comment.