diff --git a/cmdb-api/api/lib/cmdb/ipam/subnet.py b/cmdb-api/api/lib/cmdb/ipam/subnet.py index c718cb95..835ba09d 100644 --- a/cmdb-api/api/lib/cmdb/ipam/subnet.py +++ b/cmdb-api/api/lib/cmdb/ipam/subnet.py @@ -205,7 +205,7 @@ def validate_cidr(self, parent_id, cidr, _id=None): return cidr def _add_subnet(self, cidr, **kwargs): - kwargs[SubnetBuiltinAttributes.HOSTS_COUNT] = ipaddress.ip_network(cidr).num_addresses - 2 + kwargs[SubnetBuiltinAttributes.HOSTS_COUNT] = len(list(ipaddress.ip_network(cidr).hosts())) kwargs[SubnetBuiltinAttributes.USED_COUNT] = 0 kwargs[SubnetBuiltinAttributes.ASSIGN_COUNT] = 0 kwargs[SubnetBuiltinAttributes.FREE_COUNT] = kwargs[SubnetBuiltinAttributes.HOSTS_COUNT] diff --git a/docker-compose.yml b/docker-compose.yml index e84501aa..45d1a3ab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,7 +41,7 @@ services: - redis cmdb-api: - image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-api:2.4.14 + image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-api:2.4.15 container_name: cmdb-api env_file: - .env @@ -71,7 +71,7 @@ services: flask cmdb-init-acl flask init-import-user-from-acl flask init-department - nohup flask cmdb-patch -v 2.4.14 & + nohup flask cmdb-patch -v 2.4.15 & flask cmdb-counter > counter.log 2>&1 networks: new: @@ -84,7 +84,7 @@ services: test: "ps aux|grep -v grep|grep -v '1 root'|grep gunicorn || exit 1" cmdb-ui: - image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-ui:2.4.14 + image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-ui:2.4.15 container_name: cmdb-ui depends_on: cmdb-api: