forked from 3wordchant/capsul-flask
add public_ipv4_first_usable_ip, public_ipv4_last_usable_ip
This commit is contained in:
@ -332,7 +332,9 @@ class DBModel:
|
||||
|
||||
def list_hosts_with_networks(self, host_id: str):
|
||||
query = """
|
||||
SELECT hosts.id, hosts.last_health_check, host_network.network_name, host_network.public_ipv4_cidr_block FROM hosts
|
||||
SELECT hosts.id, hosts.last_health_check, host_network.network_name,
|
||||
host_network.public_ipv4_cidr_block, host_network.public_ipv4_first_usable_ip, host_network.public_ipv4_last_usable_ip
|
||||
FROM hosts
|
||||
JOIN host_network ON host_network.host = hosts.id
|
||||
"""
|
||||
if host_id is None:
|
||||
@ -351,7 +353,12 @@ class DBModel:
|
||||
if row[0] not in hosts:
|
||||
hosts[row[0]] = dict(last_health_check=row[1], networks=[])
|
||||
|
||||
hosts[row[0]]["networks"].append(dict(network_name=row[2], public_ipv4_cidr_block=row[3]))
|
||||
hosts[row[0]]["networks"].append(dict(
|
||||
network_name=row[2],
|
||||
public_ipv4_cidr_block=row[3],
|
||||
public_ipv4_first_usable_ip=row[4],
|
||||
public_ipv4_last_usable_ip=row[5]
|
||||
))
|
||||
|
||||
return hosts
|
||||
|
||||
|
Reference in New Issue
Block a user