Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix release master #7596

2 changes: 1 addition & 1 deletion gcloud/utils/cmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Loading