Skip to content

Commit

Permalink
fix: 修复请求参数问题 #7550
Browse files Browse the repository at this point in the history
  • Loading branch information
guohelu committed Oct 31, 2024
1 parent d9fd572 commit c96f518
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pipeline_plugins/cmdb_ip_picker/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,24 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id=
set、module、cloud、agent等信息
@return:
"""
params_data = json.loads(request.body)
default_host_fields = ["bk_host_id", "bk_host_name", "bk_cloud_id", "bk_host_innerip"]
if settings.ENABLE_IPV6 or settings.ENABLE_GSE_V2:
# IPV6环境下或者开启了GSE 2.0 版本
default_host_fields.append("bk_agent_id")
fields = set(default_host_fields + json.loads(request.POST.get("fields", "[]")))
fields = set(default_host_fields + params_data.get("fields", "[]"))
client = get_client_by_user(request.user.username)

topo_modules_id = set()

start = request.POST.get("start", None)
limit = request.POST.get("limit", None)
ip_str = request.POST.get("ip_str", "")
host_id_str = request.POST.get("host_id_str", None)
start = params_data.get("start", None)
limit = params_data.get("limit", None)
ip_str = params_data.get("ip_str", "")
host_id_str = params_data.get("host_id_str", None)

# get filter module id
if request.POST.get("topo", None):
topo = json.loads(request.POST.get("topo"))
if params_data.get("topo", None):
topo = params_data.get("topo")
topo_result = get_cmdb_topo_tree(request.user.username, bk_biz_id, bk_supplier_account)
if not topo_result["result"]:
return JsonResponse(topo_result)
Expand All @@ -116,7 +117,7 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id=

if start and limit:
raw_host_info_list, count = cmdb.get_filter_business_host_topo(
request.user.username, bk_biz_id, bk_supplier_account, fields, int(start), int(limit), ip_str, host_id_str
request.user.username, bk_biz_id, bk_supplier_account, fields, start, limit, ip_str, host_id_str
)
else:
raw_host_info_list, count = cmdb.get_filter_business_host_topo(
Expand Down Expand Up @@ -210,7 +211,7 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id=
host["agent"] = agent_info.get("bk_agent_alive", -1)

# search host lock status
if request.POST.get("search_host_lock", None):
if params_data.get("search_host_lock", None):
bk_host_id_list = [host_detail["bk_host_id"] for host_detail in data]
host_lock_status_result = client.cc.search_host_lock({"id_list": bk_host_id_list})
if not host_lock_status_result["result"]:
Expand Down

0 comments on commit c96f518

Please sign in to comment.