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 #7584

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,3 @@ repos:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional']
- repo: local
hooks:
- id: check-migrate
name: check migrate
entry: python scripts/check_migrate/check_migrate.py
language: system
types: [python]
- id: check-sensitive-info
name: Check Sensitive Info
entry: sh scripts/check_sensitive_info.sh
language: system
11 changes: 9 additions & 2 deletions gcloud/utils/cmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
get_client_by_user = settings.ESB_GET_CLIENT_BY_USER


def get_business_host_topo(username, bk_biz_id, supplier_account, host_fields, ip_list=None, property_filters=None):
def get_business_host_topo(
username, bk_biz_id, supplier_account, host_fields, ip_list=None, property_filters=None, page=None
):
"""获取业务下所有主机信息
:param username: 请求用户名
:type username: str
Expand Down Expand Up @@ -76,7 +78,12 @@ def get_business_host_topo(username, bk_biz_id, supplier_account, host_fields, i
"rules": [{"field": "bk_host_innerip", "operator": "in", "value": ip_list}],
}

result = batch_request(client.cc.list_biz_hosts_topo, kwargs)
if page:
kwargs["page"] = page
data = client.cc.list_biz_hosts_topo(kwargs)
result = data["data"]["info"]
else:
result = batch_request(client.cc.list_biz_hosts_topo, kwargs)

host_info_list = []
for host_topo in result:
Expand Down
9 changes: 8 additions & 1 deletion pipeline_plugins/cmdb_ip_picker/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id=
client = get_client_by_user(request.user.username)

topo_modules_id = set()
page = {
"start": int(request.GET.get("start", 0)),
"limit": int(request.GET.get("limit", 10)),
}
ip_list = json.loads(request.GET.get("ip_list", "[]"))

# get filter module id
if request.GET.get("topo", None):
Expand All @@ -109,7 +114,9 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id=
result = {"result": False, "code": ERROR_CODES.API_GSE_ERROR, "message": message}
return JsonResponse(result)

raw_host_info_list = cmdb.get_business_host_topo(request.user.username, bk_biz_id, bk_supplier_account, fields)
raw_host_info_list = cmdb.get_business_host_topo(
request.user.username, bk_biz_id, bk_supplier_account, fields, ip_list=ip_list, page=page
)

# map cloud_area_id to cloud_area
cloud_area_dict = {}
Expand Down
Loading