Skip to content

Commit

Permalink
bugfix: 修复同步不到纯 IPv6 主机的问题 (fixed #1220)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuoZhuoCrayon committed Nov 7, 2022
1 parent 1e18313 commit 7936b55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/node_man/periodic_tasks/sync_cmdb_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def _list_biz_hosts(biz_id: int, start: int) -> dict:
}
)
# 去除内网IP为空的主机
biz_hosts["info"] = [host for host in biz_hosts["info"] if host.get("bk_host_innerip")]
biz_hosts["info"] = [
host for host in biz_hosts["info"] if host.get("bk_host_innerip") or host.get("bk_host_innerip_v6")
]
return biz_hosts


Expand Down Expand Up @@ -205,10 +207,10 @@ def update_or_create_host_base(biz_id, task_id, cmdb_host_data):
# 已存在的主机批量更新,不存在的主机批量创建
for host in cmdb_host_data:
# 兼容内网IP为空的情况
if not host["bk_host_innerip"]:
if not (host.get("bk_host_innerip") or host.get("bk_host_innerip_v6")):
logger.info(
f"[sync_cmdb_host] update_or_create_host: task_id -> {task_id}, bk_biz_id -> {biz_id}, "
f"bk_host_id -> {host['bk_host_id']} bk_host_innerip is empty"
f"bk_host_id -> {host['bk_host_id']} bk_host_innerip and bk_host_innerip_v6 is empty"
)
continue

Expand Down
3 changes: 3 additions & 0 deletions dev_log/2.2.32/crayon_202211071651.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfix:
- "修复同步不到纯 IPv6 主机的问题 (fixed #1220)"

0 comments on commit 7936b55

Please sign in to comment.