diff --git a/gcloud/utils/cmdb.py b/gcloud/utils/cmdb.py index 58796e5ec..9a6407480 100644 --- a/gcloud/utils/cmdb.py +++ b/gcloud/utils/cmdb.py @@ -105,7 +105,7 @@ def get_filter_business_host_topo( :type supplier_account: int :param host_fields: 主机过滤字段 :type host_fields: list - :param start: 起始页数 + :param start: 数据偏移量 :type start: int :param limit: 每页数量,最大数量限制为 500 :type limit: int diff --git a/pipeline_plugins/cmdb_ip_picker/query.py b/pipeline_plugins/cmdb_ip_picker/query.py index 629dff201..dbfc80359 100644 --- a/pipeline_plugins/cmdb_ip_picker/query.py +++ b/pipeline_plugins/cmdb_ip_picker/query.py @@ -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) @@ -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( @@ -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"]: