-
Notifications
You must be signed in to change notification settings - Fork 377
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
feat: 配置平台(CMDB) 相关插件支持 云区域:IP #7432 #7454
Conversation
hosts = [] | ||
c_hosts = [] | ||
for host in host_list: | ||
if {host["bk_host_innerip"]: host.get("bk_cloud_id", "")} in hosts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里会有问题,改变了原有函数的行为
11b160b
to
1d850f6
Compare
18c3093
to
58349d4
Compare
:rtype: list | ||
["1", "2", "3", ...] | ||
""" | ||
ip_list = get_ip_by_regex(ip_str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看实现,这个函数只能识别不带云区域的字符串
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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]} |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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 = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set()
No description provided.