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

feat: 配置平台(CMDB) 相关插件支持 云区域:IP #7432 #7454

Merged

Conversation

lTimej
Copy link
Collaborator

@lTimej lTimej commented May 13, 2024

No description provided.

@lTimej lTimej added the type/feature 功能 label May 13, 2024
@lTimej lTimej requested a review from normal-wls May 13, 2024 02:52
@lTimej lTimej linked an issue May 13, 2024 that may be closed by this pull request
1 task
hosts = []
c_hosts = []
for host in host_list:
if {host["bk_host_innerip"]: host.get("bk_cloud_id", "")} in hosts:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里会有问题,改变了原有函数的行为

@lTimej lTimej force-pushed the release_3.32.2_by_master_7432 branch from 11b160b to 1d850f6 Compare August 15, 2024 09:12
@lTimej lTimej force-pushed the release_3.32.2_by_master_7432 branch from 18c3093 to 58349d4 Compare August 16, 2024 09:04
:rtype: list
["1", "2", "3", ...]
"""
ip_list = get_ip_by_regex(ip_str)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看实现,这个函数只能识别不带云区域的字符串

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ip_list = ["0:1.1.1.1", "2.2.2.2"]

0:1:1.1.1.1 1:2:2.2.2.2

len(host_list) == len(ip_list)

"""
ip_list = get_ip_by_regex(ip_str)
# 格式2 管控区域ID:IP
if plat_ip_reg.match(ip_str):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里如果部分带了部分没带,看上去有问题

logger.error(message)
return {"result": False, "message": message}

return {"result": True, "data": [str(host["bk_host_id"]) for host in host_list]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

host_list 看上去会有冗余,这里不合理。假如1.1.1.1的机器有两台,那么这里我填了0:1.1.1.1之后,会得到两个 host_id

:rtype: list
["1", "2", "3", ...]
"""
ip_list = get_ip_by_regex(ip_str)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ip_list = ["0:1.1.1.1", "2.2.2.2"]

0:1:1.1.1.1 1:2:2.2.2.2

len(host_list) == len(ip_list)

@@ -519,6 +562,23 @@ def get_host_topo(self, executor, biz_cc_id, supplier_account, host_attrs, ip_st
executor, biz_cc_id, supplier_account, host_attrs, ip_list=None, property_filters=property_filters
)

def get_host_list_by_cloud_id(self, executor, biz_cc_id, ip_str, supplier_account):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

调整一下函数名:get_host_list_with_cloud_id

:rtype: dict
"""
ip_dict = get_ip_or_cloudid_ip_by_regex(ip_list)
host_list = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set()

@lTimej lTimej changed the base branch from release_3.32.2_by_master to master August 21, 2024 09:31
@normal-wls normal-wls merged commit edb154a into TencentBlueKing:master Aug 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

配置平台(CMDB) 相关插件支持 云区域:IP
2 participants