From aa03c00fb13f329e846ac9a12ee3bf4cfb1e1c1b Mon Sep 17 00:00:00 2001 From: forest Date: Thu, 3 Mar 2022 12:57:52 -0600 Subject: [PATCH] fix exception on vms missing IP addresses --- capsulflask/admin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/capsulflask/admin.py b/capsulflask/admin.py index 6b57197..e08511c 100644 --- a/capsulflask/admin.py +++ b/capsulflask/admin.py @@ -163,6 +163,9 @@ def index(): host_network_key = f"{host_id}_{network['network_name']}" if host_network_key in db_vms_by_host_network: for vm in db_vms_by_host_network[host_network_key]: + if 'public_ipv4' not in vm or vm['public_ipv4'] is None: + continue + ip_address_int = int(ipaddress.ip_address(vm['public_ipv4'])) if network_start_int <= ip_address_int and ip_address_int <= network_end_int: allocation = f"{host_id}_{network['network_name']}_{len(network['allocations'])}"